LibreOffice
LibreOffice 24.2 SDK API Reference
Exported Interfaces | Public Attributes | List of all members
PreparedStatement Service Referencepublished

represents a precompiled SQL statement. More...

import"PreparedStatement.idl";

Inheritance diagram for PreparedStatement:
XMultipleResults XWarningsSupplier XPreparedBatchExecution XParameters XResultSetMetaDataSupplier XPreparedStatement XCancellable XPropertySet XCloseable XComponent PreparedStatement CallableStatement PreparedStatement CallableStatement CallableStatement

Exported Interfaces

interface com::sun::star::lang::XComponent
 optional for implementation, controls the releasing of resources and the notification of registered listeners. More...
 
interface XCloseable
 freeing all resources of a statement. More...
 
interface com::sun::star::beans::XPropertySet
 
interface com::sun::star::util::XCancellable
 could be used for canceling the execution of SQL statements, if both the DBMS and the driver support aborting an SQL statement. More...
 
interface XPreparedStatement
 is the interface for executing SQL prepared commands. More...
 
interface XResultSetMetaDataSupplier
 provides access to the description of the result set which would be generated by executing the PreparedStatement. More...
 
interface XParameters
 is used for setting parameters before execution of the precompiled statement. More...
 
interface XPreparedBatchExecution
 provides the ability of batch execution. More...
 
interface XWarningsSupplier
 controls the chaining of warnings, which may occur on every call to the connected database. More...
 
interface XMultipleResults
 covers the handling of multiple results after executing an SQL command. More...
 

Public Attributes

long QueryTimeOut
 retrieves the number of seconds the driver will wait for a Statement to execute. More...
 
long MaxFieldSize
 returns the maximum number of bytes allowed for any column value. More...
 
long MaxRows
 retrieves the maximum number of rows that a ResultSet can contain. More...
 
string CursorName
 defines the SQL cursor name that will be used by subsequent Statement execute methods. More...
 
long ResultSetConcurrency
 retrieves the result set concurrency. More...
 
long ResultSetType
 Determine the result set type. More...
 
long FetchDirection
 retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object. More...
 
long FetchSize
 retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object. More...
 

Additional Inherited Members

- Public Member Functions inherited from XCloseable
void close () raises (SQLException)
 releases all resources connected to an object. 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...
 
- Public Member Functions inherited from XPropertySet
com::sun::star::beans::XPropertySetInfo getPropertySetInfo ()
 
void setPropertyValue ([in] string aPropertyName, [in] any aValue) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
 sets the value of the property with the specified name. More...
 
any getPropertyValue ([in] string PropertyName) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 
void addPropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener xListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 adds an XPropertyChangeListener to the specified property. More...
 
void removePropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 removes an XPropertyChangeListener from the listener list. More...
 
void addVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 adds an XVetoableChangeListener to the specified property with the name PropertyName. More...
 
void removeVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 removes an XVetoableChangeListener from the listener list. More...
 
- Public Member Functions inherited from XPreparedStatement
XResultSet executeQuery () raises (SQLException)
 executes the SQL query in this PreparedStatement object and returns the result set generated by the query. More...
 
long executeUpdate () raises (SQLException)
 executes the SQL INSERT, UPDATE or DELETE statement in this com::sun::star::sdbc::PreparedStatement object. More...
 
boolean execute () raises (SQLException)
 executes any kind of SQL statement. More...
 
XConnection getConnection () raises (SQLException)
 returns the com::sun::star::sdbc::Connection object that produced this com::sun::star::sdbc::Statement object. More...
 
- Public Member Functions inherited from XResultSetMetaDataSupplier
XResultSetMetaData getMetaData () raises (SQLException)
 retrieves the number, types, and properties of a ResultSet's columns. More...
 
- Public Member Functions inherited from XParameters
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 XWarningsSupplier
any getWarnings () raises (SQLException)
 returns the first warning reported by calls on an object that supports the usage of warnings. More...
 
void clearWarnings () raises (SQLException)
 clears all warnings reported for the object implementing the interface. More...
 
- Public Member Functions inherited from XMultipleResults
XResultSet getResultSet () raises (SQLException)
 returns the current result as a com::sun::star::sdbc::ResultSet object. More...
 
long getUpdateCount () raises (SQLException)
 returns the current result as an update count. More...
 
boolean getMoreResults () raises (SQLException)
 moves to a Statement's next result. More...
 
- Protected Member Functions inherited from XComponent
void dispose ()
 The owner of an object calls this method to explicitly free all resources kept by this object and thus break cyclic references. More...
 
void addEventListener ([in] XEventListener xListener)
 adds an event listener to the object. More...
 
void removeEventListener ([in] XEventListener aListener)
 removes an event listener from the listener list. More...
 
- Protected 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...
 
- Protected Member Functions inherited from XCloseable
void close () raises (SQLException)
 releases all resources connected to an object. More...
 
- Protected Member Functions inherited from XPropertySet
com::sun::star::beans::XPropertySetInfo getPropertySetInfo ()
 
void setPropertyValue ([in] string aPropertyName, [in] any aValue) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
 sets the value of the property with the specified name. More...
 
any getPropertyValue ([in] string PropertyName) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 
void addPropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener xListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 adds an XPropertyChangeListener to the specified property. More...
 
void removePropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 removes an XPropertyChangeListener from the listener list. More...
 
void addVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 adds an XVetoableChangeListener to the specified property with the name PropertyName. More...
 
void removeVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
 removes an XVetoableChangeListener from the listener list. More...
 
- Protected Member Functions inherited from XCancellable
void cancel ()
 cancels the current job of the object. More...
 
- Protected Member Functions inherited from XPreparedStatement
XResultSet executeQuery () raises (SQLException)
 executes the SQL query in this PreparedStatement object and returns the result set generated by the query. More...
 
long executeUpdate () raises (SQLException)
 executes the SQL INSERT, UPDATE or DELETE statement in this com::sun::star::sdbc::PreparedStatement object. More...
 
boolean execute () raises (SQLException)
 executes any kind of SQL statement. More...
 
XConnection getConnection () raises (SQLException)
 returns the com::sun::star::sdbc::Connection object that produced this com::sun::star::sdbc::Statement object. More...
 
- Protected Member Functions inherited from XResultSetMetaDataSupplier
XResultSetMetaData getMetaData () raises (SQLException)
 retrieves the number, types, and properties of a ResultSet's columns. More...
 
- Protected Member Functions inherited from XParameters
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...
 
- Protected Member Functions inherited from XPreparedBatchExecution
void addBatch () raises (SQLException)
 adds a set of parameters to the batch. More...
 
void clearBatch () raises (SQLException)
 makes the set of commands in the current batch empty. More...
 
sequence< long > executeBatch () raises (SQLException)
 submits a batch of commands to the database for execution. More...
 
- Protected Member Functions inherited from XWarningsSupplier
any getWarnings () raises (SQLException)
 returns the first warning reported by calls on an object that supports the usage of warnings. More...
 
void clearWarnings () raises (SQLException)
 clears all warnings reported for the object implementing the interface. More...
 
- Protected Member Functions inherited from XMultipleResults
XResultSet getResultSet () raises (SQLException)
 returns the current result as a com::sun::star::sdbc::ResultSet object. More...
 
long getUpdateCount () raises (SQLException)
 returns the current result as an update count. More...
 
boolean getMoreResults () raises (SQLException)
 moves to a Statement's next result. More...
 

Detailed Description

represents a precompiled SQL statement.

A SQL statement is pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

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)

Only one com::sun::star::sdbc::ResultSet per com::sun::star::sdbc::Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements. All statement execute methods implicitly close a statement's current ResultSet if an open one exists.

Exported Interfaces

◆ com::sun::star::beans::XPropertySet

◆ com::sun::star::lang::XComponent

optional for implementation, controls the releasing of resources and the notification of registered listeners.

◆ com::sun::star::util::XCancellable

could be used for canceling the execution of SQL statements, if both the DBMS and the driver support aborting an SQL statement.

The implementation is optional.

◆ XCloseable

interface XCloseable

freeing all resources of a statement.

A related result set will be freed as well.

◆ XMultipleResults

interface XMultipleResults

covers the handling of multiple results after executing an SQL command.

◆ XParameters

interface XParameters

is used for setting parameters before execution of the precompiled statement.

◆ XPreparedBatchExecution

interface XPreparedBatchExecution
optional

provides the ability of batch execution.

This interface is optional for execution.

A driver implementing batch execution must return TRUE for com::sun::star::sdbc::XDatabaseMetaData::supportsBatchUpdates()

◆ XPreparedStatement

interface XPreparedStatement

is the interface for executing SQL prepared commands.

◆ XResultSetMetaDataSupplier

provides access to the description of the result set which would be generated by executing the PreparedStatement.

◆ XWarningsSupplier

interface XWarningsSupplier

controls the chaining of warnings, which may occur on every call to the connected database.

Chained warnings from previous calls will be cleared before processing a new call.

Member Data Documentation

◆ CursorName

string CursorName
property

defines the SQL cursor name that will be used by subsequent Statement execute methods.

This name can then be used in SQL positioned update/delete statements to identify the current row in the ResultSet generated by this statement. If the database does not support positioned update/delete, this property is a noop. To ensure that a cursor has the proper isolation level to support updates, the cursor's SELECT statement should be of the form "select for update ...". If the "for update" phrase is omitted, positioned updates may fail.

Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a connection.

◆ FetchDirection

long FetchDirection
property

retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object.

If this Statement object has not set a fetch direction, the return value is implementation-specific.

◆ FetchSize

long FetchSize
property

retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object.

If this Statement object has not set a fetch size, the return value is implementation-specific.

◆ MaxFieldSize

long MaxFieldSize
property

returns the maximum number of bytes allowed for any column value.

This limit is the maximum number of bytes that can be returned for any column value. The limit applies only to com::sun::star::sdbc::DataType::BINARY , com::sun::star::sdbc::DataType::VARBINARY , com::sun::star::sdbc::DataType::LONGVARBINARY , com::sun::star::sdbc::DataType::CHAR , com::sun::star::sdbc::DataType::VARCHAR , and com::sun::star::sdbc::DataType::LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.

There is no limitation, if set to zero.

◆ MaxRows

long MaxRows
property

retrieves the maximum number of rows that a ResultSet can contain.

If the limit is exceeded, the excess rows are silently dropped.
There is no limitation, if set to zero.

◆ QueryTimeOut

long QueryTimeOut
property

retrieves the number of seconds the driver will wait for a Statement to execute.

If the limit is exceeded, a SQLException is thrown. There is no limitation, if set to zero.

◆ ResultSetConcurrency

long ResultSetConcurrency
property

retrieves the result set concurrency.

See also
com::sun::star::sdbc::ResultSetConcurrency

◆ ResultSetType

long ResultSetType
property

Determine the result set type.

See also
com::sun::star::sdbc::ResultSetType

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