Get the style color and number just once
[LibreOffice.git] / offapi / com / sun / star / sdbc / XParameters.idl
blob6b173e4c8f3415e896d77fddbeb44be46f1b5f4e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 module com { module sun { module star { module io {
21 published interface XInputStream;
22 };};};};
24 module com { module sun { module star { module sdbc {
26 published interface XRef;
27 published interface XArray;
28 published interface XBlob;
29 published interface XClob;
32 /** is used for parameter setting, commonly implemented in conjunction with
33 PreparedStatements.
36 <p>
37 <b>Note:</b> The setXXX methods for setting IN parameter values
38 must specify types that are compatible with the defined SQL type of
39 the input parameter. For instance, if the IN parameter has SQL type
40 Integer, then the method
41 com::sun::star::sdbc::XParameters::setInt()
42 should be used.
44 </p>
45 <p>
46 If arbitrary parameter type conversions are required, the method
47 com::sun::star::sdbc::XParameters::setObject()
48 should be used with a target SQL type.
49 <br/>
50 <br/>
51 Example of setting a parameter;
52 <code>con</code>
53 is an active connection.
54 </p>
56 @code{.bas}
57 pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
58 pstmt.setDouble(1, 153833.00)
59 pstmt.setLong(2, 110592)
60 @endcode
62 @see com::sun::star::sdbc::XPreparedStatement
64 published interface XParameters: com::sun::star::uno::XInterface
67 /** sets the designated parameter to SQL NULL.
69 void setNull([in]long parameterIndex,
70 [in]long sqlType) raises (SQLException);
72 /** sets the designated parameter to SQL NULL. This version of setNull should
73 be used for user-named types and REF type parameters. Examples
74 of user-named types include: STRUCT, DISTINCT, OBJECT, and
75 named array types.
78 <p>
79 <b>Note:</b> To be portable, applications must give the
80 SQL type code and the fully-qualified SQL type name when specifying
81 a NULL user-defined or REF parameter. In the case of a user-named type
82 the name is the type name of the parameter itself. For a REF
83 parameter the name is the type name of the referenced type. If
84 a SDBC driver does not need the type code or type name information,
85 it may ignore it.
86 <br/>
87 Although it is intended for user-named and Ref parameters,
88 this method may be used to set a null parameter of any JDBC type.
89 If the parameter does not have a user-named or REF type, the given
90 typeName is ignored.
91 </p>
92 @param parameterIndex
93 the first parameter is 1, the second is 2, ...
94 @param sqlType
95 the type of the column to set to `NULL`
96 @param typeName
97 the name of the type
98 @throws SQLException
99 if a database access error occurs.
101 void setObjectNull([in]long parameterIndex,
102 [in]long sqlType,
103 [in]string typeName) raises (SQLException);
105 /** sets the designated parameter to a boolean value. The driver converts this
106 to a SQL BIT value when it sends it to the database.
107 @param parameterIndex
108 the first parameter is 1, the second is 2, ...
109 @param x
110 the parameter value
111 @throws SQLException
112 if a database access error occurs.
114 void setBoolean([in]long parameterIndex, [in]boolean x)
115 raises (SQLException);
117 /** sets the designated parameter to a byte value. The driver converts this
118 to a SQL TINYINT value when it sends it to the database.
119 @param parameterIndex
120 the first parameter is 1, the second is 2, ...
121 @param x
122 the parameter value
123 @throws SQLException
124 if a database access error occurs.
126 void setByte([in]long parameterIndex, [in]byte x) raises (SQLException);
128 /** sets the designated parameter to a short value. The driver converts this
129 to a SQL SMALLINT value when it sends it to the database.
130 @param parameterIndex
131 the first parameter is 1, the second is 2, ...
132 @param x
133 the parameter value
134 @throws SQLException
135 if a database access error occurs.
137 void setShort([in]long parameterIndex, [in]short x) raises (SQLException);
139 /** sets the designated parameter to a long value. The driver converts this
140 to a SQL INTEGER value when it sends it to the database.
141 @param parameterIndex
142 the first parameter is 1, the second is 2, ...
143 @param x
144 the parameter value
145 @throws SQLException
146 if a database access error occurs.
148 void setInt([in]long parameterIndex, [in]long x) raises (SQLException);
150 /** sets the designated parameter to a hyper value. The driver converts this
151 to a SQL BIGINT value when it sends it to the database.
152 @param parameterIndex
153 the first parameter is 1, the second is 2, ...
154 @param x
155 the parameter value
156 @throws SQLException
157 if a database access error occurs.
159 void setLong([in]long parameterIndex, [in]hyper x) raises (SQLException);
161 /** sets the designated parameter to a float value. The driver converts this
162 to a SQL FLOAT value when it sends it to the database.
163 @param parameterIndex
164 the first parameter is 1, the second is 2, ...
165 @param x
166 the parameter value
167 @throws SQLException
168 if a database access error occurs.
170 void setFloat([in]long parameterIndex, [in]float x) raises (SQLException);
172 /** sets the designated parameter to a double value. The driver converts this
173 to a SQL DOUBLE value when it sends it to the database.
174 @param parameterIndex
175 the first parameter is 1, the second is 2, ...
176 @param x
177 the parameter value
178 @throws SQLException
179 if a database access error occurs.
181 void setDouble([in]long parameterIndex, [in]double x) raises (SQLException);
183 /** sets the designated parameter to a string value. The driver converts this
184 to a SQL VARCHAR or LONGVARCHAR value (depending on the argument's
185 size relative to the driver's limits on VARCHARs) when it sends
186 it to the database.
187 @param parameterIndex
188 the first parameter is 1, the second is 2, ...
189 @param x
190 the parameter value
191 @throws SQLException
192 if a database access error occurs.
194 void setString([in]long parameterIndex, [in]string x) raises (SQLException);
196 /** sets the designated parameter to a sequence of bytes. The driver converts
197 this to a SQL VARBINARY or LONGVARBINARY (depending on the
198 argument's size relative to the driver's limits on VARBINARYs)
199 when it sends it to the database.
200 @param parameterIndex
201 the first parameter is 1, the second is 2, ...
202 @param x
203 the parameter value
204 @throws SQLException
205 if a database access error occurs.
207 void setBytes([in]long parameterIndex, [in]sequence<byte> x)
208 raises (SQLException);
210 /** sets the designated parameter to a date value. The driver converts this
211 to a SQL DATE value when it sends it to the database.
212 @param parameterIndex
213 the first parameter is 1, the second is 2, ...
214 @param x
215 the parameter value
216 @throws SQLException
217 if a database access error occurs.
219 void setDate([in]long parameterIndex, [in]com::sun::star::util::Date x)
220 raises (SQLException);
222 /** sets the designated parameter to a time value. The driver converts this
223 to a SQL TIME value when it sends it to the database.
224 @param parameterIndex
225 the first parameter is 1, the second is 2, ...
226 @param x
227 the parameter value
228 @throws SQLException
229 if a database access error occurs.
231 void setTime([in]long parameterIndex, [in]com::sun::star::util::Time x)
232 raises (SQLException);
234 /** sets the designated parameter to a datetime value. The driver
235 converts this to a SQL TIMESTAMP value when it sends it to the
236 database.
237 @param parameterIndex
238 the first parameter is 1, the second is 2, ...
239 @param x
240 the parameter value
241 @throws SQLException
242 if a database access error occurs.
244 void setTimestamp([in]long parameterIndex,
245 [in]com::sun::star::util::DateTime x) raises (SQLException);
247 /** sets the designated parameter to the given input stream, which will have
248 the specified number of bytes.
249 When a very large binary value is input to a LONGVARBINARY or LONGVARCHAR
250 parameter, it may be more practical to send it via an
251 com::sun::star::io::XInputStream
252 . SDBC will read the data from the stream as needed, until it reaches end-of-file.
253 @param parameterIndex
254 the first parameter is 1, the second is 2, ...
255 @param x
256 the parameter value
257 @param length
258 the number of bytes in the stream
259 @throws SQLException
260 if a database access error occurs.
262 void setBinaryStream([in]long parameterIndex,
263 [in]com::sun::star::io::XInputStream x,
264 [in]long length) raises (SQLException);
266 /** sets the designated parameter to the given input stream, which will have
267 the specified number of bytes.
268 When a very large binary value is input to a LONGVARCHAR
269 parameter, it may be more practical to send it via a
270 com::sun::star::io::XInputStream
271 . SDBC will read the data from the stream as needed, until it reaches end-of-file.
272 @param parameterIndex
273 the first parameter is 1, the second is 2, ...
274 @param x
275 the parameter value
276 @param length
277 the number of characters in the stream
278 @throws SQLException
279 if a database access error occurs.
281 void setCharacterStream([in]long parameterIndex,
282 [in]com::sun::star::io::XInputStream x,
283 [in]long length) raises (SQLException);
285 /** sets the value of a parameter using an any.
288 <p>The given object will be converted to the targetSqlType
289 before being sent to the database.
290 If the object has a custom mapping (is of a class implementing SQLData),
291 the SDBC driver should call its method <code>writeSQL</code> to write it
292 to the SQL data stream.
293 If, on the other hand, the object is of a service implementing Ref, Blob,
294 Clob, Struct, or Array, the driver should pass it to the database as a
295 value of the corresponding SQL type.
296 </p>
297 <p>Note that this method may be used to pass database-specific
298 abstract data types.
299 </p>
300 @param parameterIndex
301 the first parameter is 1, the second is 2, ...
302 @param x
303 the parameter value
304 @throws SQLException
305 if a database access error occurs.
307 void setObject([in]long parameterIndex, [in]any x)
308 raises (SQLException);
310 /** set a value from the Datatype ANY for a parameter.
314 <p>The given object will be converted to the targetSqlType
315 before being sent to the database.
316 If the object has a custom mapping (is of a class implementing SQLData),
317 the SDBC driver should call its method <code>writeSQL</code> to write it
318 to the SQL data stream.
319 If, on the other hand, the object is of a service implementing Ref, Blob,
320 Clob, Struct, or Array, the driver should pass it to the database as a
321 value of the corresponding SQL type.
322 </p>
323 <p>Note that this method may be used to pass database-specific
324 abstract data types.
325 </p>
326 @param parameterIndex
327 the first parameter is 1, the second is 2, ...
328 @param x
329 the parameter value
330 @param targetSqlType
331 the SQL type (as defined in
332 com::sun::star::sdbc::DataType
333 ) to be sent to the database. The scale argument may further qualify this type.
334 @param scale
336 com::sun::star::sdbc::DataType::DECIMAL
338 com::sun::star::sdbc::DataType::NUMERIC
339 types, this is the number of digits after the decimal point. For all other types, this value will be ignored.
340 @throws SQLException
341 if a database access error occurs.
343 void setObjectWithInfo([in]long parameterIndex,
344 [in]any x, [in]long targetSqlType, [in]long scale)
345 raises (SQLException);
347 /** sets a REF(&amp;lt;structured-type&amp;gt;) parameter.
348 @param parameterIndex
349 the first parameter is 1, the second is 2, ...
350 @param x
351 the parameter value
352 @throws SQLException
353 if a database access error occurs.
355 void setRef ([in]long parameterIndex, [in]XRef x) raises (SQLException);
357 /** sets a BLOB parameter.
358 @param parameterIndex
359 the first parameter is 1, the second is 2, ...
360 @param x
361 the parameter value
362 @throws SQLException
363 if a database access error occurs.
365 void setBlob ([in]long parameterIndex, [in]XBlob x) raises (SQLException);
367 /** sets a CLOB parameter.
368 @param parameterIndex
369 the first parameter is 1, the second is 2, ...
370 @param x
371 the parameter value
372 @throws SQLException
373 if a database access error occurs.
375 void setClob ([in]long parameterIndex, [in]XClob x) raises (SQLException);
377 /** sets an Array parameter.
378 @param parameterIndex
379 the first parameter is 1, the second is 2, ...
380 @param x
381 the parameter value
382 @throws SQLException
383 if a database access error occurs.
385 void setArray ([in]long parameterIndex, [in]XArray x) raises (SQLException);
388 /** clears the current parameter values immediately.
391 <p>In general, parameter values remain in force for repeated use of a
392 Statement. Setting a parameter value automatically clears its
393 previous value. However, in some cases it is useful to immediately
394 release the resources used by the current parameter values; this can
395 be done by calling clearParameters.
396 </p>
397 @throws SQLException
398 if a database access error occurs.
400 void clearParameters() raises (SQLException);
404 }; }; }; };
406 /*===========================================================================
407 ===========================================================================*/
409 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */