LibreOffice
LibreOffice 7.4 SDK API Reference
Public Member Functions | List of all members
XParameters Interface Referencepublished

is used for parameter setting, commonly implemented in conjunction with PreparedStatements. More...

import"XParameters.idl";

Inheritance diagram for XParameters:
XInterface XDatabaseDataProvider PreparedStatement RowSet DatabaseDataProvider PreparedStatement CallableStatement PreparedStatement RowSet CallableStatement CallableStatement DataForm

Public Member Functions

void setNull ([in]long parameterIndex, [in]long sqlType) raises (SQLException)
 sets the designated parameter to SQL NULL. More...
 
void setObjectNull ([in]long parameterIndex, [in]long sqlType, [in]string typeName) raises (SQLException)
 sets the designated parameter to SQL NULL. More...
 
void setBoolean ([in]long parameterIndex, [in]boolean x) raises (SQLException)
 sets the designated parameter to a boolean value. More...
 
void setByte ([in]long parameterIndex, [in]byte x) raises (SQLException)
 sets the designated parameter to a byte value. More...
 
void setShort ([in]long parameterIndex, [in]short x) raises (SQLException)
 sets the designated parameter to a short value. More...
 
void setInt ([in]long parameterIndex, [in]long x) raises (SQLException)
 sets the designated parameter to a long value. More...
 
void setLong ([in]long parameterIndex, [in]hyper x) raises (SQLException)
 sets the designated parameter to a hyper value. More...
 
void setFloat ([in]long parameterIndex, [in]float x) raises (SQLException)
 sets the designated parameter to a float value. More...
 
void setDouble ([in]long parameterIndex, [in]double x) raises (SQLException)
 sets the designated parameter to a double value. More...
 
void setString ([in]long parameterIndex, [in]string x) raises (SQLException)
 sets the designated parameter to a string value. More...
 
void setBytes ([in]long parameterIndex, [in]sequence< byte > x) raises (SQLException)
 sets the designated parameter to a sequence of bytes. More...
 
void setDate ([in]long parameterIndex, [in]com::sun::star::util::Date x) raises (SQLException)
 sets the designated parameter to a date value. More...
 
void setTime ([in]long parameterIndex, [in]com::sun::star::util::Time x) raises (SQLException)
 sets the designated parameter to a time value. More...
 
void setTimestamp ([in]long parameterIndex, [in]com::sun::star::util::DateTime x) raises (SQLException)
 sets the designated parameter to a datetime value. More...
 
void setBinaryStream ([in]long parameterIndex, [in]com::sun::star::io::XInputStream x, [in]long length) raises (SQLException)
 sets the designated parameter to the given input stream, which will have the specified number of bytes. More...
 
void setCharacterStream ([in]long parameterIndex, [in]com::sun::star::io::XInputStream x, [in]long length) raises (SQLException)
 sets the designated parameter to the given input stream, which will have the specified number of bytes. More...
 
void setObject ([in]long parameterIndex, [in]any x) raises (SQLException)
 sets the value of a parameter using an any. More...
 
void setObjectWithInfo ([in]long parameterIndex, [in]any x, [in]long targetSqlType, [in]long scale) raises (SQLException)
 set a value from the Datatype ANY for a parameter. More...
 
void setRef ([in]long parameterIndex, [in]XRef x) raises (SQLException)
 sets a REF(&lt;structured-type&gt;) parameter. More...
 
void setBlob ([in]long parameterIndex, [in]XBlob x) raises (SQLException)
 sets a BLOB parameter. More...
 
void setClob ([in]long parameterIndex, [in]XClob x) raises (SQLException)
 sets a CLOB parameter. More...
 
void setArray ([in]long parameterIndex, [in]XArray x) raises (SQLException)
 sets an Array parameter. More...
 
void clearParameters () raises (SQLException)
 clears the current parameter values immediately. More...
 
- Public Member Functions inherited from XInterface
any queryInterface ([in] type aType)
 queries for a new interface to an existing UNO object. More...
 
void acquire ()
 increases the reference counter by one. More...
 
void release ()
 decreases the reference counter by one. More...
 

Detailed Description

is used for parameter setting, commonly implemented in conjunction with PreparedStatements.

Note: The setXXX methods for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type Integer, then the method com::sun::star::sdbc::XParameters::setInt() should be used.

If arbitrary parameter type conversions are required, the method com::sun::star::sdbc::XParameters::setObject() should be used with a target SQL type.

Example of setting a parameter; con is an active connection.

pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
pstmt.setDouble(1, 153833.00)
pstmt.setLong(2, 110592)
See also
com::sun::star::sdbc::XPreparedStatement

Member Function Documentation

◆ clearParameters()

void clearParameters ( )
raises (SQLException
)

clears the current parameter values immediately.

In general, parameter values remain in force for repeated use of a Statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters.

Exceptions
SQLExceptionif a database access error occurs.

◆ setArray()

void setArray ( [in] long  parameterIndex,
[in] XArray  x 
)
raises (SQLException
)

sets an Array parameter.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setBinaryStream()

void setBinaryStream ( [in] long  parameterIndex,
[in] com::sun::star::io::XInputStream  x,
[in] long  length 
)
raises (SQLException
)

sets the designated parameter to the given input stream, which will have the specified number of bytes.

When a very large binary value is input to a LONGVARBINARY or LONGVARCHAR parameter, it may be more practical to send it via an com::sun::star::io::XInputStream . SDBC will read the data from the stream as needed, until it reaches end-of-file.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
lengththe number of bytes in the stream
Exceptions
SQLExceptionif a database access error occurs.

◆ setBlob()

void setBlob ( [in] long  parameterIndex,
[in] XBlob  x 
)
raises (SQLException
)

sets a BLOB parameter.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setBoolean()

void setBoolean ( [in] long  parameterIndex,
[in] boolean  x 
)
raises (SQLException
)

sets the designated parameter to a boolean value.

The driver converts this to a SQL BIT value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setByte()

void setByte ( [in] long  parameterIndex,
[in] byte  x 
)
raises (SQLException
)

sets the designated parameter to a byte value.

The driver converts this to a SQL TINYINT value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setBytes()

void setBytes ( [in] long  parameterIndex,
[in] sequence< byte >  x 
)
raises (SQLException
)

sets the designated parameter to a sequence of bytes.

The driver converts this to a SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's limits on VARBINARYs) when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setCharacterStream()

void setCharacterStream ( [in] long  parameterIndex,
[in] com::sun::star::io::XInputStream  x,
[in] long  length 
)
raises (SQLException
)

sets the designated parameter to the given input stream, which will have the specified number of bytes.

When a very large binary value is input to a LONGVARCHAR parameter, it may be more practical to send it via a com::sun::star::io::XInputStream . SDBC will read the data from the stream as needed, until it reaches end-of-file.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
lengththe number of characters in the stream
Exceptions
SQLExceptionif a database access error occurs.

◆ setClob()

void setClob ( [in] long  parameterIndex,
[in] XClob  x 
)
raises (SQLException
)

sets a CLOB parameter.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setDate()

void setDate ( [in] long  parameterIndex,
[in] com::sun::star::util::Date  x 
)
raises (SQLException
)

sets the designated parameter to a date value.

The driver converts this to a SQL DATE value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setDouble()

void setDouble ( [in] long  parameterIndex,
[in] double  x 
)
raises (SQLException
)

sets the designated parameter to a double value.

The driver converts this to a SQL DOUBLE value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setFloat()

void setFloat ( [in] long  parameterIndex,
[in] float  x 
)
raises (SQLException
)

sets the designated parameter to a float value.

The driver converts this to a SQL FLOAT value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setInt()

void setInt ( [in] long  parameterIndex,
[in] long  x 
)
raises (SQLException
)

sets the designated parameter to a long value.

The driver converts this to a SQL INTEGER value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setLong()

void setLong ( [in] long  parameterIndex,
[in] hyper  x 
)
raises (SQLException
)

sets the designated parameter to a hyper value.

The driver converts this to a SQL BIGINT value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setNull()

void setNull ( [in] long  parameterIndex,
[in] long  sqlType 
)
raises (SQLException
)

sets the designated parameter to SQL NULL.

◆ setObject()

void setObject ( [in] long  parameterIndex,
[in] any  x 
)
raises (SQLException
)

sets the value of a parameter using an any.

The given object will be converted to the targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing SQLData), the SDBC driver should call its method writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a service implementing Ref, Blob, Clob, Struct, or Array, the driver should pass it to the database as a value of the corresponding SQL type.

Note that this method may be used to pass database-specific abstract data types.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setObjectNull()

void setObjectNull ( [in] long  parameterIndex,
[in] long  sqlType,
[in] string  typeName 
)
raises (SQLException
)

sets the designated parameter to SQL NULL.

This version of setNull should be used for user-named types and REF type parameters. Examples of user-named types include: STRUCT, DISTINCT, OBJECT, and named array types.

Note: To be portable, applications must give the SQL type code and the fully-qualified SQL type name when specifying a NULL user-defined or REF parameter. In the case of a user-named type the name is the type name of the parameter itself. For a REF parameter the name is the type name of the referenced type. If a SDBC driver does not need the type code or type name information, it may ignore it.
Although it is intended for user-named and Ref parameters, this method may be used to set a null parameter of any JDBC type. If the parameter does not have a user-named or REF type, the given typeName is ignored.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
sqlTypethe type of the column to set to NULL
typeNamethe name of the type
Exceptions
SQLExceptionif a database access error occurs.

◆ setObjectWithInfo()

void setObjectWithInfo ( [in] long  parameterIndex,
[in] any  x,
[in] long  targetSqlType,
[in] long  scale 
)
raises (SQLException
)

set a value from the Datatype ANY for a parameter.

The given object will be converted to the targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing SQLData), the SDBC driver should call its method writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a service implementing Ref, Blob, Clob, Struct, or Array, the driver should pass it to the database as a value of the corresponding SQL type.

Note that this method may be used to pass database-specific abstract data types.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
targetSqlTypethe SQL type (as defined in com::sun::star::sdbc::DataType ) to be sent to the database. The scale argument may further qualify this type.
scalefor com::sun::star::sdbc::DataType::DECIMAL or com::sun::star::sdbc::DataType::NUMERIC types, this is the number of digits after the decimal point. For all other types, this value will be ignored.
Exceptions
SQLExceptionif a database access error occurs.

◆ setRef()

void setRef ( [in] long  parameterIndex,
[in] XRef  x 
)
raises (SQLException
)

sets a REF(&lt;structured-type&gt;) parameter.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setShort()

void setShort ( [in] long  parameterIndex,
[in] short  x 
)
raises (SQLException
)

sets the designated parameter to a short value.

The driver converts this to a SQL SMALLINT value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setString()

void setString ( [in] long  parameterIndex,
[in] string  x 
)
raises (SQLException
)

sets the designated parameter to a string value.

The driver converts this to a SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHARs) when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setTime()

void setTime ( [in] long  parameterIndex,
[in] com::sun::star::util::Time  x 
)
raises (SQLException
)

sets the designated parameter to a time value.

The driver converts this to a SQL TIME value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

◆ setTimestamp()

void setTimestamp ( [in] long  parameterIndex,
[in] com::sun::star::util::DateTime  x 
)
raises (SQLException
)

sets the designated parameter to a datetime value.

The driver converts this to a SQL TIMESTAMP value when it sends it to the database.

Parameters
parameterIndexthe first parameter is 1, the second is 2, ...
xthe parameter value
Exceptions
SQLExceptionif a database access error occurs.

The documentation for this interface was generated from the following file: