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
;
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
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>
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.
72 Example of setting a parameter;
74 is an active connection.
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
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,
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
111 @param parameterIndex
112 the first parameter is 1, the second is 2, ...
114 the type of the column to set to <NULL/>
118 if a database access error occurs.
120 void setObjectNull
([in]long parameterIndex
,
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, ...
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, ...
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, ...
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, ...
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, ...
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, ...
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, ...
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
214 @param parameterIndex
215 the first parameter is 1, the second is 2, ...
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, ...
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, ...
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, ...
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
268 @param parameterIndex
269 the first parameter is 1, the second is 2, ...
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, ...
290 the number of bytes in the stream
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, ...
310 the number of characters in the stream
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.
331 <p>Note that this method may be used to pass database-specific
334 @param parameterIndex
335 the first parameter is 1, the second is 2, ...
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.
358 <p>Note that this method may be used to pass database-specific
361 @param parameterIndex
362 the first parameter is 1, the second is 2, ...
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.
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.
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(&lt;structured-type&gt;) parameter.
384 @param parameterIndex
385 the first parameter is 1, the second is 2, ...
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, ...
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, ...
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, ...
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.
438 if a database access error occurs.
440 void clearParameters
() raises
(SQLException
);
443 //=============================================================================
447 /*===========================================================================
448 ===========================================================================*/
451 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */