service PreparedStatement in module com::sun::star::sdbc::

(Global Index)

Syntax

service PreparedStatement;

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 XParameters::setInt() should be used.

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

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

Example

:StarBASIC
 pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
 pstmt.setDouble(1, 153833.00)
 pstmt.setLong(2, 110592)

Only one ResultSet per 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::lang::XComponent [ OPTIONAL ]

Description

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


com::sun::star::sdbc::XCloseable

Description

freeing all resources of a statement. A related resultset will be freed as well.


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

Description

provides information about and access to the properties from an implementation.


com::sun::star::util::XCancellable [ OPTIONAL ]

Description

could be used for cancelling the execution of SQL statements, if both the DBMS and the driver support aborting an SQL statement. The implementation is optional.


com::sun::star::sdbc::XPreparedStatement

Description

is the interface for executing SQL prepared commands.


com::sun::star::sdbc::XResultSetMetaDataSupplier

Description

provides access to the result set description.


com::sun::star::sdbc::XParameters

Description

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


com::sun::star::sdbc::XPreparedBatchExecution [ OPTIONAL ]

Description

provides the ability of batch execution. This interface is optional for execution.

A driver implementing batch execution must return true for XDatabaseMetaData::supportsBatchUpdates()


com::sun::star::sdbc::XWarningsSupplier

Description

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.


com::sun::star::sdbc::XMultipleResults

Description

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


Property Summary

QueryTimeOut 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.

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

MaxRows 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.

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

ResultSetConcurrency retrieves the result set concurrency.

ResultSetType Determine the result set type.

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

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

Property Details



QueryTimeOut

Syntax

long QueryTimeOut;

Description

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.


MaxFieldSize

Syntax

long MaxFieldSize;

Description

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 DataType::BINARY , DataType::VARBINARY , DataType::LONGVARBINARY , DataType::CHAR , DataType::VARCHAR , and DataType::LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.

There is no limitation, if set to zero.


MaxRows

Syntax

long MaxRows;

Description

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.


CursorName

Syntax

string CursorName;

Description

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 insure 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.


ResultSetConcurrency

Syntax

long ResultSetConcurrency;

Description

retrieves the result set concurrency.

See also

ResultSetConcurrency;

ResultSetType

Syntax

long ResultSetType;

Description

Determine the result set type.

See also

ResultSetType;

FetchDirection

Syntax

long FetchDirection;

Description

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

Syntax

long FetchSize;

Description

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.

Top of Page