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

interface XStatement

Methods' Summary
executeQuery executes a SQL statement that returns a single ResultSet.  
executeUpdate executes an SQL INSERT, UPDATE, or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.  
execute executes a SQL statement that may return multiple results.  
getConnection returns the com::sun::star::sdbc::Connection object that produced this Statement object.  
Methods' Details
executeQuery
XResultSet
executeQuery( [in] string  sql )
raises( SQLException );

Description
executes a SQL statement that returns a single ResultSet.
Parameter sql
the SQL statement which should be executed
Returns
a ResultSet that contains the data produced by the query; never `NULL`
Throws
SQLException if a database access error occurs.
executeUpdate
long
executeUpdate( [in] string  sql )
raises( SQLException );

Description
executes an SQL INSERT, UPDATE, or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.
Parameter sql
a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
Returns
either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing
Throws
SQLException if a database access error occurs.
execute
boolean
execute( [in] string  sql )
raises( SQLException );

Description
executes a SQL statement that may return multiple results.

Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string. The navigation through multiple results is covered by com::sun::star::sdbc::XMultipleResults.

The execute method executes a SQL statement and indicates the form of the first result. You can then use com::sun::star::sdbc::XMultipleResults::getResultSet() or com::sun::star::sdbc::XMultipleResults::getUpdateCount() to retrieve the result, and com::sun::star::sdbc::XMultipleResults::getMoreResults() to move to any subsequent result(s).

Parameter sql
any SQL statement
Returns
`TRUE` if the next result is a ResultSet; `FALSE` if it is an update count or there are no more results
Throws
SQLException if a database access error occurs.
getConnection
XConnection
getConnection()
raises( SQLException );

Description
returns the com::sun::star::sdbc::Connection object that produced this Statement object.
Returns
the connection that produced this statement
Throws
SQLException if a database access error occurs.
Top of Page