1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef __com_sun_star_sdbc_XParameters_idl__
20 #define __com_sun_star_sdbc_XParameters_idl__
22 #include
<com
/sun
/star
/uno
/XInterface.idl
>
24 #include
<com
/sun
/star
/util
/Date.idl
>
26 #include
<com
/sun
/star
/util
/DateTime.idl
>
28 #include
<com
/sun
/star
/util
/Time.idl
>
30 module com
{ module sun
{ module star
{ module io
{
31 published
interface XInputStream
;
34 #include
<com
/sun
/star
/sdbc
/SQLException.idl
>
36 module com
{ module sun
{ module star
{ module sdbc
{
38 published
interface XRef
;
39 published
interface XArray
;
40 published
interface XBlob
;
41 published
interface XClob
;
44 /** is used for parameter setting, commonly implemented in conjunction with
49 <b>Note:</b> The setXXX methods for setting IN parameter values
50 must specify types that are compatible with the defined SQL type of
51 the input parameter. For instance, if the IN parameter has SQL type
52 Integer, then the method
53 com::sun::star::sdbc::XParameters::setInt()
58 If arbitrary parameter type conversions are required, the method
59 com::sun::star::sdbc::XParameters::setObject()
60 should be used with a target SQL type.
63 Example of setting a parameter;
65 is an active connection.
69 pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
70 pstmt.setDouble(1, 153833.00)
71 pstmt.setLong(2, 110592)
74 @see com::sun::star::sdbc::XPreparedStatement
76 published
interface XParameters
: com
::sun
::star
::uno
::XInterface
79 /** sets the designated parameter to SQL NULL.
81 void setNull
([in]long parameterIndex
,
82 [in]long sqlType
) raises
(SQLException
);
84 /** sets the designated parameter to SQL NULL. This version of setNull should
85 be used for user-named types and REF type parameters. Examples
86 of user-named types include: STRUCT, DISTINCT, OBJECT, and
91 <b>Note:</b> To be portable, applications must give the
92 SQL type code and the fully-qualified SQL type name when specifying
93 a NULL user-defined or REF parameter. In the case of a user-named type
94 the name is the type name of the parameter itself. For a REF
95 parameter the name is the type name of the referenced type. If
96 a SDBC driver does not need the type code or type name information,
99 Although it is intended for user-named and Ref parameters,
100 this method may be used to set a null parameter of any JDBC type.
101 If the parameter does not have a user-named or REF type, the given
104 @param parameterIndex
105 the first parameter is 1, the second is 2, ...
107 the type of the column to set to `NULL`
111 if a database access error occurs.
113 void setObjectNull
([in]long parameterIndex
,
115 [in]string typeName
) raises
(SQLException
);
117 /** sets the designated parameter to a boolean value. The driver converts this
118 to a SQL BIT value when it sends it to the database.
119 @param parameterIndex
120 the first parameter is 1, the second is 2, ...
124 if a database access error occurs.
126 void setBoolean
([in]long parameterIndex
, [in]boolean x
)
127 raises
(SQLException
);
129 /** sets the designated parameter to a byte value. The driver converts this
130 to a SQL TINYINT value when it sends it to the database.
131 @param parameterIndex
132 the first parameter is 1, the second is 2, ...
136 if a database access error occurs.
138 void setByte
([in]long parameterIndex
, [in]byte x
) raises
(SQLException
);
140 /** sets the designated parameter to a short value. The driver converts this
141 to a SQL SMALLINT value when it sends it to the database.
142 @param parameterIndex
143 the first parameter is 1, the second is 2, ...
147 if a database access error occurs.
149 void setShort
([in]long parameterIndex
, [in]short x
) raises
(SQLException
);
151 /** sets the designated parameter to a long value. The driver converts this
152 to a SQL INTEGER value when it sends it to the database.
153 @param parameterIndex
154 the first parameter is 1, the second is 2, ...
158 if a database access error occurs.
160 void setInt
([in]long parameterIndex
, [in]long x
) raises
(SQLException
);
162 /** sets the designated parameter to a hyper value. The driver converts this
163 to a SQL BIGINT 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 setLong
([in]long parameterIndex
, [in]hyper x
) raises
(SQLException
);
173 /** sets the designated parameter to a float value. The driver converts this
174 to a SQL FLOAT value when it sends it to the database.
175 @param parameterIndex
176 the first parameter is 1, the second is 2, ...
180 if a database access error occurs.
182 void setFloat
([in]long parameterIndex
, [in]float x
) raises
(SQLException
);
184 /** sets the designated parameter to a double value. The driver converts this
185 to a SQL DOUBLE value when it sends it to the database.
186 @param parameterIndex
187 the first parameter is 1, the second is 2, ...
191 if a database access error occurs.
193 void setDouble
([in]long parameterIndex
, [in]double x
) raises
(SQLException
);
195 /** sets the designated parameter to a string value. The driver converts this
196 to a SQL VARCHAR or LONGVARCHAR value (depending on the argument's
197 size relative to the driver's limits on VARCHARs) when it sends
199 @param parameterIndex
200 the first parameter is 1, the second is 2, ...
204 if a database access error occurs.
206 void setString
([in]long parameterIndex
, [in]string x
) raises
(SQLException
);
208 /** sets the designated parameter to a sequence of bytes. The driver converts
209 this to a SQL VARBINARY or LONGVARBINARY (depending on the
210 argument's size relative to the driver's limits on VARBINARYs)
211 when it sends it to the database.
212 @param parameterIndex
213 the first parameter is 1, the second is 2, ...
217 if a database access error occurs.
219 void setBytes
([in]long parameterIndex
, [in]sequence
<byte> x
)
220 raises
(SQLException
);
222 /** sets the designated parameter to a date value. The driver converts this
223 to a SQL DATE value when it sends it to the database.
224 @param parameterIndex
225 the first parameter is 1, the second is 2, ...
229 if a database access error occurs.
231 void setDate
([in]long parameterIndex
, [in]com
::sun
::star
::util
::Date x
)
232 raises
(SQLException
);
234 /** sets the designated parameter to a time value. The driver converts this
235 to a SQL TIME value when it sends it to the database.
236 @param parameterIndex
237 the first parameter is 1, the second is 2, ...
241 if a database access error occurs.
243 void setTime
([in]long parameterIndex
, [in]com
::sun
::star
::util
::Time x
)
244 raises
(SQLException
);
246 /** sets the designated parameter to a datetime value. The driver
247 converts this to a SQL TIMESTAMP value when it sends it to the
249 @param parameterIndex
250 the first parameter is 1, the second is 2, ...
254 if a database access error occurs.
256 void setTimestamp
([in]long parameterIndex
,
257 [in]com
::sun
::star
::util
::DateTime x
) raises
(SQLException
);
259 /** sets the designated parameter to the given input stream, which will have
260 the specified number of bytes.
261 When a very large binary value is input to a LONGVARBINARY or LONGVARCHAR
262 parameter, it may be more practical to send it via an
263 com::sun::star::io::XInputStream
264 . SDBC will read the data from the stream as needed, until it reaches end-of-file.
265 @param parameterIndex
266 the first parameter is 1, the second is 2, ...
270 the number of bytes in the stream
272 if a database access error occurs.
274 void setBinaryStream
([in]long parameterIndex
,
275 [in]com
::sun
::star
::io
::XInputStream x
,
276 [in]long length
) raises
(SQLException
);
278 /** sets the designated parameter to the given input stream, which will have
279 the specified number of bytes.
280 When a very large binary value is input to a LONGVARCHAR
281 parameter, it may be more practical to send it via a
282 com::sun::star::io::XInputStream
283 . SDBC will read the data from the stream as needed, until it reaches end-of-file.
284 @param parameterIndex
285 the first parameter is 1, the second is 2, ...
289 the number of characters in the stream
291 if a database access error occurs.
293 void setCharacterStream
([in]long parameterIndex
,
294 [in]com
::sun
::star
::io
::XInputStream x
,
295 [in]long length
) raises
(SQLException
);
297 /** sets the value of a parameter using an any.
300 <p>The given object will be converted to the targetSqlType
301 before being sent to the database.
302 If the object has a custom mapping (is of a class implementing SQLData),
303 the SDBC driver should call its method <code>writeSQL</code> to write it
304 to the SQL data stream.
305 If, on the other hand, the object is of a service implementing Ref, Blob,
306 Clob, Struct, or Array, the driver should pass it to the database as a
307 value of the corresponding SQL type.
309 <p>Note that this method may be used to pass database-specific
312 @param parameterIndex
313 the first parameter is 1, the second is 2, ...
317 if a database access error occurs.
319 void setObject
([in]long parameterIndex
, [in]any x
)
320 raises
(SQLException
);
322 /** set a value from the Datatype ANY for a parameter.
326 <p>The given object will be converted to the targetSqlType
327 before being sent to the database.
328 If the object has a custom mapping (is of a class implementing SQLData),
329 the SDBC driver should call its method <code>writeSQL</code> to write it
330 to the SQL data stream.
331 If, on the other hand, the object is of a service implementing Ref, Blob,
332 Clob, Struct, or Array, the driver should pass it to the database as a
333 value of the corresponding SQL type.
335 <p>Note that this method may be used to pass database-specific
338 @param parameterIndex
339 the first parameter is 1, the second is 2, ...
343 the SQL type (as defined in
344 com::sun::star::sdbc::DataType
345 ) to be sent to the database. The scale argument may further qualify this type.
348 com::sun::star::sdbc::DataType::DECIMAL
350 com::sun::star::sdbc::DataType::NUMERIC
351 types, this is the number of digits after the decimal point. For all other types, this value will be ignored.
353 if a database access error occurs.
355 void setObjectWithInfo
([in]long parameterIndex
,
356 [in]any x
, [in]long targetSqlType
, [in]long scale
)
357 raises
(SQLException
);
359 /** sets a REF(&lt;structured-type&gt;) parameter.
360 @param parameterIndex
361 the first parameter is 1, the second is 2, ...
365 if a database access error occurs.
367 void setRef
([in]long parameterIndex
, [in]XRef x
) raises
(SQLException
);
369 /** sets a BLOB parameter.
370 @param parameterIndex
371 the first parameter is 1, the second is 2, ...
375 if a database access error occurs.
377 void setBlob
([in]long parameterIndex
, [in]XBlob x
) raises
(SQLException
);
379 /** sets a CLOB parameter.
380 @param parameterIndex
381 the first parameter is 1, the second is 2, ...
385 if a database access error occurs.
387 void setClob
([in]long parameterIndex
, [in]XClob x
) raises
(SQLException
);
389 /** sets an Array parameter.
390 @param parameterIndex
391 the first parameter is 1, the second is 2, ...
395 if a database access error occurs.
397 void setArray
([in]long parameterIndex
, [in]XArray x
) raises
(SQLException
);
400 /** clears the current parameter values immediately.
403 <p>In general, parameter values remain in force for repeated use of a
404 Statement. Setting a parameter value automatically clears its
405 previous value. However, in some cases it is useful to immediately
406 release the resources used by the current parameter values; this can
407 be done by calling clearParameters.
410 if a database access error occurs.
412 void clearParameters
() raises
(SQLException
);
418 /*===========================================================================
419 ===========================================================================*/
422 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */