Bump for 3.6-28
[LibreOffice.git] / offapi / com / sun / star / sdbc / XParameters.idl
blob369d5db9a900301a2d9e84fdbfb74149bda5046e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef __com_sun_star_sdbc_XParameters_idl__
29 #define __com_sun_star_sdbc_XParameters_idl__
31 #include <com/sun/star/uno/XInterface.idl>
33 #include <com/sun/star/util/Date.idl>
35 #include <com/sun/star/util/DateTime.idl>
37 #include <com/sun/star/util/Time.idl>
39 module com { module sun { module star { module io {
40 published interface XInputStream;
41 };};};};
43 #include <com/sun/star/sdbc/SQLException.idl>
45 module com { module sun { module star { module sdbc {
47 published interface XRef;
48 published interface XArray;
49 published interface XBlob;
50 published interface XClob;
53 /** is used for parameter setting, commonly implemented in conjunction with
54 PreparedStatements.
57 <p>
58 <b>Note:</b> The setXXX methods for setting IN parameter values
59 must specify types that are compatible with the defined SQL type of
60 the input parameter. For instance, if the IN parameter has SQL type
61 Integer, then the method
62 <member scope="com::sun::star::sdbc">XParameters::setInt()</member>
63 should be used.
65 </p>
66 <p>
67 If arbitrary parameter type conversions are required, the method
68 <member scope="com::sun::star::sdbc">XParameters::setObject()</member>
69 should be used with a target SQL type.
70 <br/>
71 <br/>
72 Example of setting a parameter;
73 <code>con</code>
74 is an active connection.
75 </p>
77 @example <listing>pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
78 pstmt.setDouble(1, 153833.00)
79 pstmt.setLong(2, 110592)
80 </listing>@see com::sun::star::sdbc::XPreparedStatement
82 published interface XParameters: com::sun::star::uno::XInterface
85 /** sets the designated parameter to SQL NULL.
87 void setNull([in]long parameterIndex,
88 [in]long sqlType) raises (SQLException);
89 //-------------------------------------------------------------------------
91 /** sets the designated parameter to SQL NULL. This version of setNull should
92 be used for user-named types and REF type parameters. Examples
93 of user-named types include: STRUCT, DISTINCT, OBJECT, and
94 named array types.
97 <p>
98 <b>Note:</b> To be portable, applications must give the
99 SQL type code and the fully-qualified SQL type name when specifying
100 a NULL user-defined or REF parameter. In the case of a user-named type
101 the name is the type name of the parameter itself. For a REF
102 parameter the name is the type name of the referenced type. If
103 a SDBC driver does not need the type code or type name information,
104 it may ignore it.
105 <br/>
106 Although it is intended for user-named and Ref parameters,
107 this method may be used to set a null parameter of any JDBC type.
108 If the parameter does not have a user-named or REF type, the given
109 typeName is ignored.
110 </p>
111 @param parameterIndex
112 the first parameter is 1, the second is 2, ...
113 @param sqlType
114 the type of the column to set to <NULL/>
115 @param typeName
116 the name of the type
117 @throws SQLException
118 if a database access error occurs.
120 void setObjectNull([in]long parameterIndex,
121 [in]long sqlType,
122 [in]string typeName) raises (SQLException);
123 //-------------------------------------------------------------------------
125 /** sets the designated parameter to a boolean value. The driver converts this
126 to a SQL BIT value when it sends it to the database.
127 @param parameterIndex
128 the first parameter is 1, the second is 2, ...
129 @param x
130 the parameter value
131 @throws SQLException
132 if a database access error occurs.
134 void setBoolean([in]long parameterIndex, [in]boolean x)
135 raises (SQLException);
136 //-------------------------------------------------------------------------
138 /** sets the designated parameter to a byte value. The driver converts this
139 to a SQL TINYINT value when it sends it to the database.
140 @param parameterIndex
141 the first parameter is 1, the second is 2, ...
142 @param x
143 the parameter value
144 @throws SQLException
145 if a database access error occurs.
147 void setByte([in]long parameterIndex, [in]byte x) raises (SQLException);
148 //-------------------------------------------------------------------------
150 /** sets the designated parameter to a short value. The driver converts this
151 to a SQL SMALLINT 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 setShort([in]long parameterIndex, [in]short x) raises (SQLException);
160 //-------------------------------------------------------------------------
162 /** sets the designated parameter to a long value. The driver converts this
163 to a SQL INTEGER value when it sends it to the database.
164 @param parameterIndex
165 the first parameter is 1, the second is 2, ...
166 @param x
167 the parameter value
168 @throws SQLException
169 if a database access error occurs.
171 void setInt([in]long parameterIndex, [in]long x) raises (SQLException);
172 //-------------------------------------------------------------------------
174 /** sets the designated parameter to a hyper value. The driver converts this
175 to a SQL BIGINT value when it sends it to the database.
176 @param parameterIndex
177 the first parameter is 1, the second is 2, ...
178 @param x
179 the parameter value
180 @throws SQLException
181 if a database access error occurs.
183 void setLong([in]long parameterIndex, [in]hyper x) raises (SQLException);
184 //-------------------------------------------------------------------------
186 /** sets the designated parameter to a float value. The driver converts this
187 to a SQL FLOAT value when it sends it to the database.
188 @param parameterIndex
189 the first parameter is 1, the second is 2, ...
190 @param x
191 the parameter value
192 @throws SQLException
193 if a database access error occurs.
195 void setFloat([in]long parameterIndex, [in]float x) raises (SQLException);
196 //-------------------------------------------------------------------------
198 /** sets the designated parameter to a double value. The driver converts this
199 to a SQL DOUBLE value 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 setDouble([in]long parameterIndex, [in]double x) raises (SQLException);
208 //-------------------------------------------------------------------------
210 /** sets the designated parameter to a string value. The driver converts this
211 to a SQL VARCHAR or LONGVARCHAR value (depending on the argument's
212 size relative to the driver's limits on VARCHARs) when it sends
213 it to the database.
214 @param parameterIndex
215 the first parameter is 1, the second is 2, ...
216 @param x
217 the parameter value
218 @throws SQLException
219 if a database access error occurs.
221 void setString([in]long parameterIndex, [in]string x) raises (SQLException);
222 //-------------------------------------------------------------------------
224 /** sets the designated parameter to a sequence of bytes. The driver converts
225 this to a SQL VARBINARY or LONGVARBINARY (depending on the
226 argument's size relative to the driver's limits on VARBINARYs)
227 when it sends it to the database.
228 @param parameterIndex
229 the first parameter is 1, the second is 2, ...
230 @param x
231 the parameter value
232 @throws SQLException
233 if a database access error occurs.
235 void setBytes([in]long parameterIndex, [in]sequence<byte> x)
236 raises (SQLException);
237 //-------------------------------------------------------------------------
239 /** sets the designated parameter to a date value. The driver converts this
240 to a SQL DATE value when it sends it to the database.
241 @param parameterIndex
242 the first parameter is 1, the second is 2, ...
243 @param x
244 the parameter value
245 @throws SQLException
246 if a database access error occurs.
248 void setDate([in]long parameterIndex, [in]com::sun::star::util::Date x)
249 raises (SQLException);
250 //-------------------------------------------------------------------------
252 /** sets the designated parameter to a time value. The driver converts this
253 to a SQL TIME value when it sends it to the database.
254 @param parameterIndex
255 the first parameter is 1, the second is 2, ...
256 @param x
257 the parameter value
258 @throws SQLException
259 if a database access error occurs.
261 void setTime([in]long parameterIndex, [in]com::sun::star::util::Time x)
262 raises (SQLException);
263 //-------------------------------------------------------------------------
265 /** sets the designated parameter to a datetime value. The driver
266 converts this to a SQL TIMESTAMP value when it sends it to the
267 database.
268 @param parameterIndex
269 the first parameter is 1, the second is 2, ...
270 @param x
271 the parameter value
272 @throws SQLException
273 if a database access error occurs.
275 void setTimestamp([in]long parameterIndex,
276 [in]com::sun::star::util::DateTime x) raises (SQLException);
277 //-------------------------------------------------------------------------
279 /** sets the designated parameter to the given input stream, which will have
280 the specified number of bytes.
281 When a very large binary value is input to a LONGVARBINARY or LONGVARCHAR
282 parameter, it may be more practical to send it via an
283 <type scope="com::sun::star::io">XInputStream</type>
284 . SDBC will read the data from the stream as needed, until it reaches end-of-file.
285 @param parameterIndex
286 the first parameter is 1, the second is 2, ...
287 @param x
288 the parameter value
289 @param length
290 the number of bytes in the stream
291 @throws SQLException
292 if a database access error occurs.
294 void setBinaryStream([in]long parameterIndex,
295 [in]com::sun::star::io::XInputStream x,
296 [in]long length) raises (SQLException);
297 //-------------------------------------------------------------------------
299 /** sets the designated parameter to the given input stream, which will have
300 the specified number of bytes.
301 When a very large binary value is input to a LONGVARCHAR
302 parameter, it may be more practical to send it via a
303 <type scope="com::sun::star::io">XInputStream</type>
304 . SDBC will read the data from the stream as needed, until it reaches end-of-file.
305 @param parameterIndex
306 the first parameter is 1, the second is 2, ...
307 @param x
308 the parameter value
309 @param length
310 the number of characters in the stream
311 @throws SQLException
312 if a database access error occurs.
314 void setCharacterStream([in]long parameterIndex,
315 [in]com::sun::star::io::XInputStream x,
316 [in]long length) raises (SQLException);
317 //-------------------------------------------------------------------------
319 /** sets the value of a parameter using an any.
322 <p>The given object will be converted to the targetSqlType
323 before being sent to the database.
324 If the object has a custom mapping (is of a class implementing SQLData),
325 the SDBC driver should call its method <code>writeSQL</code> to write it
326 to the SQL data stream.
327 If, on the other hand, the object is of a service implementing Ref, Blob,
328 Clob, Struct, or Array, the driver should pass it to the database as a
329 value of the corresponding SQL type.
330 </p>
331 <p>Note that this method may be used to pass database-specific
332 abstract data types.
333 </p>
334 @param parameterIndex
335 the first parameter is 1, the second is 2, ...
336 @param x
337 the parameter value
338 @throws SQLException
339 if a database access error occurs.
341 void setObject([in]long parameterIndex, [in]any x)
342 raises (SQLException);
343 //-------------------------------------------------------------------------
345 /** set a value from the Datatype ANY for a parameter.
349 <p>The given object will be converted to the targetSqlType
350 before being sent to the database.
351 If the object has a custom mapping (is of a class implementing SQLData),
352 the SDBC driver should call its method <code>writeSQL</code> to write it
353 to the SQL data stream.
354 If, on the other hand, the object is of a service implementing Ref, Blob,
355 Clob, Struct, or Array, the driver should pass it to the database as a
356 value of the corresponding SQL type.
357 </p>
358 <p>Note that this method may be used to pass database-specific
359 abstract data types.
360 </p>
361 @param parameterIndex
362 the first parameter is 1, the second is 2, ...
363 @param x
364 the parameter value
365 @param targetSqlType
366 the SQL type (as defined in
367 <type scope="com::sun::star::sdbc">DataType</type>
368 ) to be sent to the database. The scale argument may further qualify this type.
369 @param scale
371 <member scope="com::sun::star::sdbc">DataType::DECIMAL</member>
373 <member scope="com::sun::star::sdbc">DataType::NUMERIC</member>
374 types, this is the number of digits after the decimal point. For all other types, this value will be ignored.
375 @throws SQLException
376 if a database access error occurs.
378 void setObjectWithInfo([in]long parameterIndex,
379 [in]any x, [in]long targetSqlType, [in]long scale)
380 raises (SQLException);
381 //-------------------------------------------------------------------------
383 /** sets a REF(&amp;lt;structured-type&amp;gt;) parameter.
384 @param parameterIndex
385 the first parameter is 1, the second is 2, ...
386 @param x
387 the parameter value
388 @throws SQLException
389 if a database access error occurs.
391 void setRef ([in]long parameterIndex, [in]XRef x) raises (SQLException);
392 //-------------------------------------------------------------------------
394 /** sets a BLOB parameter.
395 @param parameterIndex
396 the first parameter is 1, the second is 2, ...
397 @param x
398 the parameter value
399 @throws SQLException
400 if a database access error occurs.
402 void setBlob ([in]long parameterIndex, [in]XBlob x) raises (SQLException);
403 //-------------------------------------------------------------------------
405 /** sets a CLOB parameter.
406 @param parameterIndex
407 the first parameter is 1, the second is 2, ...
408 @param x
409 the parameter value
410 @throws SQLException
411 if a database access error occurs.
413 void setClob ([in]long parameterIndex, [in]XClob x) raises (SQLException);
414 //-------------------------------------------------------------------------
416 /** sets an Array parameter.
417 @param parameterIndex
418 the first parameter is 1, the second is 2, ...
419 @param x
420 the parameter value
421 @throws SQLException
422 if a database access error occurs.
424 void setArray ([in]long parameterIndex, [in]XArray x) raises (SQLException);
426 //-------------------------------------------------------------------------
428 /** clears the current parameter values immediately.
431 <p>In general, parameter values remain in force for repeated use of a
432 Statement. Setting a parameter value automatically clears its
433 previous value. However, in some cases it is useful to immediately
434 release the resources used by the current parameter values; this can
435 be done by calling clearParameters.
436 </p>
437 @throws SQLException
438 if a database access error occurs.
440 void clearParameters() raises (SQLException);
443 //=============================================================================
445 }; }; }; };
447 /*===========================================================================
448 ===========================================================================*/
449 #endif
451 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */