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 .
20 module com
{ module sun
{ module star
{ module io
{
21 published
interface XInputStream
;
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
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()
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.
51 Example of setting a parameter;
53 is an active connection.
57 pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
58 pstmt.setDouble(1, 153833.00)
59 pstmt.setLong(2, 110592)
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
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,
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
93 the first parameter is 1, the second is 2, ...
95 the type of the column to set to `NULL`
99 if a database access error occurs.
101 void setObjectNull
([in]long parameterIndex
,
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, ...
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, ...
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, ...
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, ...
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, ...
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, ...
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, ...
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
187 @param parameterIndex
188 the first parameter is 1, the second is 2, ...
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, ...
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, ...
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, ...
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
237 @param parameterIndex
238 the first parameter is 1, the second is 2, ...
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, ...
258 the number of bytes in the stream
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, ...
277 the number of characters in the stream
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.
297 <p>Note that this method may be used to pass database-specific
300 @param parameterIndex
301 the first parameter is 1, the second is 2, ...
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.
323 <p>Note that this method may be used to pass database-specific
326 @param parameterIndex
327 the first parameter is 1, the second is 2, ...
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.
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.
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(&lt;structured-type&gt;) parameter.
348 @param parameterIndex
349 the first parameter is 1, the second is 2, ...
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, ...
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, ...
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, ...
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.
398 if a database access error occurs.
400 void clearParameters
() raises
(SQLException
);
406 /*===========================================================================
407 ===========================================================================*/
409 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */