| java.lang.Object org.continuent.sequoia.driver.Statement
All known Subclasses: org.continuent.sequoia.driver.PreparedStatement,
Statement | public class Statement implements java.sql.Statement(Code) | | A Statement object is used for executing a static SQL
statement and obtaining the results produced by it.
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 Statements execute
methods implicitly close a statement's current ResultSet if an
open one exists.
See Also: java.sql.Statement See Also: DriverResultSet author: Emmanuel Cecchet author: Vadim Kassin author: Jean-Bernard van Zuylen author: version: 1.0 |
Method Summary | |
public synchronized void | addBatch(String sql) Adds sql to the current list of commands. | protected void | addWarningTo(SQLWarning addMe, SQLWarning toThis) Utility to add warnings to a given warning chain.
Parameters: addMe - (in) warnings to be added Parameters: toThis - (in/out) reference chain on which to add addMe. | public void | cancel() Could be use by one thread to cancel a statement that is being executed by
another thread. | public void | clearBatch() Empties the current list of commands. | public void | clearWarnings() After this call, getWarnings returns null
until a new warning is reported for this Statement . | public void | close() In many cases, it is desirable to immediately release a Statement's
database and JDBC resources instead of waiting for this to happen when it
is automatically closed. | public boolean | execute(String sql) Execute a SQL statement that may return multiple results. | protected boolean | execute(String sqlSkeleton, String parameters) | public boolean | execute(String sql, int autoGeneratedKeys) Executes the given SQL statement, which may return multiple results, and
signals the driver that any auto-generated keys should be made available
for retrieval. | public boolean | execute(String sql, int[] columnIndexes) Executes the given SQL statement, which may return multiple results, and
signals the driver that the auto-generated keys indicated in the given
array should be made available for retrieval. | public boolean | execute(String sql, String[] columnNames) Executes the given SQL statement, which may return multiple results, and
signals the driver that the auto-generated keys indicated in the given
array should be made available for retrieval. | public int[] | executeBatch() | public java.sql.ResultSet | executeQuery(String sql) | protected java.sql.ResultSet | executeQuery(String sqlSkeleton, String parameters) | public int | executeUpdate(String sql) Execute a SQL INSERT, UPDATE or DELETE statement. | public int | executeUpdate(String sql, int autoGeneratedKeys) Executes the given SQL statement and signals the driver with the given flag
about whether the auto-generated keys produced by this
Statement object should be made available for retrieval. | public int | executeUpdate(String sql, int[] columnIndexes) Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval. | public int | executeUpdate(String sql, String[] columnNames) Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval. | protected int | executeUpdateWithSkeleton(String sqlSkeleton, String parameters) Execute a SQL INSERT, UPDATE or DELETE statement. | protected void | finalize() | public java.sql.Connection | getConnection() | public int | getFetchDirection() | public int | getFetchSize() | public java.sql.ResultSet | getGeneratedKeys() Retrieves any auto-generated keys created as a result of executing this
Statement object. | public int | getMaxFieldSize() The maxFieldSize limit (in bytes) is the maximum amount of data returned
for any column value; it only applies to BINARY ,
VARBINARY ,LONGVARBINARY ,CHAR ,
VARCHAR and LONGVARCHAR columns. | public int | getMaxRows() The maxRows limit is set to limit the number of rows that any
ResultSet can contain. | public boolean | getMoreResults() Return the true if next available result is a ResultSet or false it this is
an update count. | public boolean | getMoreResults(int current) Moves to this Statement object's next result, deals with any
current ResultSet object(s) according to the instructions
specified by the given flag, and returns true if the next
result is a ResultSet object. | public int | getQueryTimeout() The queryTimeout limit is the number of seconds the driver will wait for a
Statement to execute. | public java.sql.ResultSet | getResultSet() Returns the current result as a ResultSet . | public int | getResultSetConcurrency() Retrieve the concurrency mode for the ResultSet . | public int | getResultSetHoldability() Retrieves the result set holdability for ResultSet objects
generated by this Statement object. | public int | getResultSetType() Retrieve the type of the generated ResultSet . | public int | getUpdateCount() Returns the current result as an update count, if the result is a
ResultSet or there are no more results, -1 is returned. | public SQLWarning | getWarnings() The first warning reported by calls on this Statement is returned. | protected boolean | isClosed() Test if this statement is closed. | public void | setCursorName(String name) Defines the SQL cursor name that will be used by subsequent execute
methods. | public void | setEscapeProcessing(boolean enable) If escape scanning is on (the default), the driver will do escape
substitution before sending the SQL to the database. | public void | setFetchDirection(int direction) | public void | setFetchSize(int rows) Set the default fetch size for the produced ResultSet. | public void | setMaxFieldSize(int max) Sets the maxFieldSize . | public void | setMaxRows(int max) Sets the maximum number of rows that any ResultSet can
contain. | public void | setQueryTimeout(int seconds) Sets the number of seconds the driver will wait for a
Statement object to execute. | protected void | setReadRequestParameters(RequestWithResultSetParameters request) | public void | setResultSetConcurrency(int value) | public void | setResultSetType(int value) |
driver | protected Driver driver(Code) | | The Driver used to create connections
|
escapeProcessing | protected boolean escapeProcessing(Code) | | Should the driver to escape processing before sending to the DB?
|
generatedKeysFlag | protected int generatedKeysFlag(Code) | | |
result | protected ResultSet result(Code) | | The current result for a read request
|
timeout | protected int timeout(Code) | | Query timeout in seconds (0 means no timeout)
|
updateCount | protected int updateCount(Code) | | The update count for a write request
|
Statement | Statement(Connection c, Driver driver)(Code) | | Creates a new Statement instance.
Parameters: c - the Connection that created us Parameters: driver - tje Driver used to create connections |
addBatch | public synchronized void addBatch(String sql) throws SQLException(Code) | | Adds sql to the current list of commands.
Parameters: sql - an SQL statement that returns an update count (INSERT or UPDATE) exception: SQLException - if an error occurs |
addWarningTo | protected void addWarningTo(SQLWarning addMe, SQLWarning toThis)(Code) | | Utility to add warnings to a given warning chain.
Parameters: addMe - (in) warnings to be added Parameters: toThis - (in/out) reference chain on which to add addMe. If null, willbe equal to addMe after the function returns |
cancel | public void cancel() throws SQLException(Code) | | Could be use by one thread to cancel a statement that is being executed by
another thread. We don't support that for instance.
exception: SQLException - if an error occurs |
clearWarnings | public void clearWarnings() throws SQLException(Code) | | After this call, getWarnings returns null
until a new warning is reported for this Statement .
exception: SQLException - if a database access error occurs (why?) |
close | public void close() throws SQLException(Code) | | In many cases, it is desirable to immediately release a Statement's
database and JDBC resources instead of waiting for this to happen when it
is automatically closed. The close method provides this immediate release.
Note: A Statement is automatically closed when it is garbage
collected. When a Statement is closed, its current ResultSet, if one
exists, is also closed.
exception: SQLException - if a database access error occurs (why?) |
execute | public boolean execute(String sql) throws SQLException(Code) | | Execute a SQL statement that may return multiple results.
Parameters: sql - any SQL statement true if the result is a ResultSet or false if it is an integer exception: SQLException - if an error occurs |
execute | protected boolean execute(String sqlSkeleton, String parameters) throws SQLException(Code) | | Execute a SQL statement that returns a single ResultSet
Parameters: sqlSkeleton - the SQL request squeleton or null Parameters: parameters - PreparedStaement parameters a ResulSet that contains the data produced by the query throws: SQLException - if a database access error occurs or if this statementis closed |
execute | public boolean execute(String sql, int autoGeneratedKeys) throws SQLException(Code) | | Executes the given SQL statement, which may return multiple results, and
signals the driver that any auto-generated keys should be made available
for retrieval. The driver will ignore this signal if the SQL statement is
not an INSERT statement.
In 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 execute method executes an SQL statement and indicates
the form of the first result. You must then use the methods
getResultSet or getUpdateCount to retrieve
the result, and getMoreResults to move to any subsequent
result(s).
Parameters: sql - any SQL statement Parameters: autoGeneratedKeys - a constant indicating whether auto-generated keysshould be made available for retrieval using the methodgetGeneratedKeys ; one of the following constants:Statement.RETURN_GENERATED_KEYS orStatement.NO_GENERATED_KEYS true if the first result is a ResultSet object; false if it is an update count or there areno results exception: SQLException - if a database access error occurs See Also: Statement.getResultSet See Also: Statement.getUpdateCount See Also: Statement.getMoreResults() See Also: Statement.getGeneratedKeys since: JDK 1.4 |
execute | public boolean execute(String sql, int[] columnIndexes) throws SQLException(Code) | | Executes the given SQL statement, which may return multiple results, and
signals the driver that the auto-generated keys indicated in the given
array should be made available for retrieval. This array contains the
indexes of the columns in the target table that contain the auto-generated
keys that should be made available. The driver will ignore the array if the
given SQL statement is not an INSERT statement.
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 execute method executes an SQL statement and indicates
the form of the first result. You must then use the methods
getResultSet or getUpdateCount to retrieve
the result, and getMoreResults to move to any subsequent
result(s).
Parameters: sql - any SQL statement Parameters: columnIndexes - an array of the indexes of the columns in the insertedrow that should be made available for retrieval by a call to themethod getGeneratedKeys true if the first result is a ResultSet object; false if it is an update count or there areno results exception: SQLException - if a database access error occurs See Also: Statement.getResultSet See Also: Statement.getUpdateCount See Also: Statement.getMoreResults() since: JDK 1.4 |
execute | public boolean execute(String sql, String[] columnNames) throws SQLException(Code) | | Executes the given SQL statement, which may return multiple results, and
signals the driver that the auto-generated keys indicated in the given
array should be made available for retrieval. This array contains the names
of the columns in the target table that contain the auto-generated keys
that should be made available. The driver will ignore the array if the
given SQL statement is not an INSERT statement.
In 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 execute method executes an SQL statement and indicates
the form of the first result. You must then use the methods
getResultSet or getUpdateCount to retrieve
the result, and getMoreResults to move to any subsequent
result(s).
Parameters: sql - any SQL statement Parameters: columnNames - an array of the names of the columns in the inserted rowthat should be made available for retrieval by a call to themethod getGeneratedKeys true if the next result is a ResultSet object; false if it is an update count or there areno more results exception: SQLException - if a database access error occurs See Also: Statement.getResultSet See Also: Statement.getUpdateCount See Also: Statement.getMoreResults() See Also: Statement.getGeneratedKeys since: JDK 1.4 |
executeBatch | public int[] executeBatch() throws BatchUpdateException(Code) | | Execute a batch of commands
an array containing update count that corresponding to the commandsthat executed successfully exception: BatchUpdateException - if an error occurs on one statement (thenumber of updated rows for the successfully executedstatements can be found inBatchUpdateException.getUpdateCounts()) |
executeQuery | public java.sql.ResultSet executeQuery(String sql) throws SQLException(Code) | | Execute a SQL statement that returns a single ResultSet
Parameters: sql - typically a static SQL SELECT statement a ResulSet that contains the data produced by the query exception: SQLException - if a database access error occurs |
executeQuery | protected java.sql.ResultSet executeQuery(String sqlSkeleton, String parameters) throws SQLException(Code) | | Execute a SQL statement that returns a single ResultSet
Parameters: sqlSkeleton - the SQL request squeleton or null Parameters: parameters - PreparedStaement parameters a ResulSet that contains the data produced by the query exception: SQLException - if a database access error occurs or if thisstatement is closed |
executeUpdate | public int executeUpdate(String sql) throws SQLException(Code) | | Execute a SQL INSERT, UPDATE or DELETE statement. In addition SQL
statements that return nothing such as SQL DDL statements can be executed
Parameters: sql - a SQL statement either a row count, or 0 for SQL commands exception: SQLException - if a database access error occurs |
executeUpdate | public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException(Code) | | Executes the given SQL statement and signals the driver with the given flag
about whether the auto-generated keys produced by this
Statement object should be made available for retrieval.
Parameters: sql - must be an SQL INSERT ,UPDATE orDELETE statement or an SQL statement that returnsnothing Parameters: autoGeneratedKeys - a flag indicating whether auto-generated keysshould be made available for retrieval; one of the followingconstants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS either the row count for INSERT ,UPDATE or DELETE statements, or0 for SQL statements that return nothing exception: SQLException - if a database access error occurs, the given SQLstatement returns a ResultSet object, or thegiven constant is not one of those allowed since: JDK 1.4 |
executeUpdate | public int executeUpdate(String sql, int[] columnIndexes) throws SQLException(Code) | | Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval. The driver will ignore the array if the SQL statement is not
an INSERT statement.
Parameters: sql - an SQL INSERT ,UPDATE orDELETE statement or an SQL statement that returnsnothing, such as an SQL DDL statement Parameters: columnIndexes - an array of column indexes indicating the columns thatshould be returned from the inserted row either the row count for INSERT ,UPDATE , or DELETE statements, or 0for SQL statements that return nothing exception: SQLException - if a database access error occurs or the SQLstatement returns a ResultSet object since: JDK 1.4 |
executeUpdate | public int executeUpdate(String sql, String[] columnNames) throws SQLException(Code) | | Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval. The driver will ignore the array if the SQL statement is not
an INSERT statement.
Parameters: sql - an SQL INSERT ,UPDATE orDELETE statement or an SQL statement that returnsnothing Parameters: columnNames - an array of the names of the columns that should bereturned from the inserted row either the row count for INSERT ,UPDATE , or DELETE statements, or 0for SQL statements that return nothing exception: SQLException - if a database access error occurs since: JDK 1.4 |
executeUpdateWithSkeleton | protected int executeUpdateWithSkeleton(String sqlSkeleton, String parameters) throws SQLException(Code) | | Execute a SQL INSERT, UPDATE or DELETE statement. In addition SQL
statements that return nothing such as SQL DDL statements can be executed
Parameters: sqlSkeleton - the SQL request squeleton or null Parameters: parameters - PreparedStaement parameters either a row count, or 0 for SQL commands exception: SQLException - if a database access error occurs or if thisstatement is closed |
getGeneratedKeys | public java.sql.ResultSet getGeneratedKeys() throws SQLException(Code) | | Retrieves any auto-generated keys created as a result of executing this
Statement object. If this Statement object
did not generate any keys, an empty ResultSet object is
returned.
a ResultSet object containing the auto-generatedkey(s) generated by the execution of this Statement object exception: SQLException - if a database access error occurs since: JDK 1.4 |
getMaxFieldSize | public int getMaxFieldSize() throws SQLException(Code) | | The maxFieldSize limit (in bytes) is the maximum amount of data returned
for any column value; it only applies to BINARY ,
VARBINARY ,LONGVARBINARY ,CHAR ,
VARCHAR and LONGVARCHAR columns. If the limit
is exceeded, the excess data is silently discarded.
Note: We don't do anything with this value yet.
the current max column size limit; zero means unlimited exception: SQLException - if a database access error occurs |
getMaxRows | public int getMaxRows() throws SQLException(Code) | | The maxRows limit is set to limit the number of rows that any
ResultSet can contain. If the limit is exceeded, the excess
rows are silently dropped.
the current maximum row limit; zero means unlimited exception: SQLException - if a database access error occurs |
getMoreResults | public boolean getMoreResults() throws SQLException(Code) | | Return the true if next available result is a ResultSet or false it this is
an update count. If the result is false and getUpdateCount() returns -1
then there is no more result
Any open ResultSet is implicitly closed.
true for a ResultSet, false otherwise exception: SQLException - if an error occurs |
getMoreResults | public boolean getMoreResults(int current) throws SQLException(Code) | | Moves to this Statement object's next result, deals with any
current ResultSet object(s) according to the instructions
specified by the given flag, and returns true if the next
result is a ResultSet object.
There are no more results when the following is true :
(!getMoreResults() && (getUpdateCount() == -1)
Parameters: current - one of the following Statement constantsindicating what should happen to current ResultSet objects obtained using the methodgetResultSetCLOSE_CURRENT_RESULT ,KEEP_CURRENT_RESULT , or CLOSE_ALL_RESULTS true if the next result is a ResultSet object; false if it is an update count or there areno more results exception: SQLException - if a database access error occurs since: JDK 1.4 See Also: Statement.execute(String) |
getQueryTimeout | public int getQueryTimeout() throws SQLException(Code) | | The queryTimeout limit is the number of seconds the driver will wait for a
Statement to execute. If the limit is exceeded, a SQLException
is thrown.
the current query timeout limit in seconds; 0 = unlimited exception: SQLException - if a database access error occurs |
getResultSetConcurrency | public int getResultSetConcurrency() throws SQLException(Code) | | Retrieve the concurrency mode for the ResultSet .
CONCUR_READ_ONLY or CONCUR_UPDATABLE exception: SQLException - never |
getResultSetHoldability | public int getResultSetHoldability() throws SQLException(Code) | | Retrieves the result set holdability for ResultSet objects
generated by this Statement object.
either ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT exception: SQLException - if a database access error occurs since: JDK 1.4 |
getResultSetType | public int getResultSetType() throws SQLException(Code) | | Retrieve the type of the generated ResultSet .
one of TYPE_FORWARD_ONLY orTYPE_SCROLL_INSENSITIVE exception: SQLException - never |
getUpdateCount | public int getUpdateCount() throws SQLException(Code) | | Returns the current result as an update count, if the result is a
ResultSet or there are no more results, -1 is returned. It
should only be called once per result.
the current result as an update count. exception: SQLException - if a database access error occurs |
getWarnings | public SQLWarning getWarnings() throws SQLException(Code) | | The first warning reported by calls on this Statement is returned. A
Statement's execute methods clear its SQLWarning chain. Subsequent
Statement warnings will be chained to this SQLWarning.
The Warning chain is automatically cleared each time a statement is
(re)executed.
Note: if you are processing a ResultSet then any
warnings associated with ResultSet reads will be chained on
the ResultSet object.
the first SQLWarning on null exception: SQLException - if a database access error occurs or this method iscalled on a closed statement |
isClosed | protected boolean isClosed()(Code) | | Test if this statement is closed.
true if this statement is closed |
setCursorName | public void setCursorName(String name) throws SQLException(Code) | | Defines the SQL cursor name that will be used by subsequent 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 a database doesn't support positioned update/delete, this
method is a no-op.
Parameters: name - the new cursor name exception: SQLException - not supported |
setEscapeProcessing | public void setEscapeProcessing(boolean enable) throws SQLException(Code) | | If escape scanning is on (the default), the driver will do escape
substitution before sending the SQL to the database.
Parameters: enable - true to enable; false to disable exception: SQLException - if a database access error occurs |
setFetchSize | public void setFetchSize(int rows) throws SQLException(Code) | | Set the default fetch size for the produced ResultSet.
Parameters: rows - number of rows that should be fetched from the database exception: SQLException - if a database access error occurs or the condition0 <= size <= this.getMaxRows is not satisfied |
setMaxFieldSize | public void setMaxFieldSize(int max) throws SQLException(Code) | | Sets the maxFieldSize .
Parameters: max - the new max column size limit; 0 means unlimited exception: SQLException - if a database access error occurs or the conditionmax >= 0 is not satisfied |
setMaxRows | public void setMaxRows(int max) throws SQLException(Code) | | Sets the maximum number of rows that any ResultSet can
contain.
Parameters: max - the new max rows limit; 0 means unlimited exception: SQLException - if a database access error occurs or the conditionmax >= 0 is not satisfied |
setQueryTimeout | public void setQueryTimeout(int seconds) throws SQLException(Code) | | Sets the number of seconds the driver will wait for a
Statement object to execute.
Parameters: seconds - the new query timeout limit in seconds; 0 means no timeout exception: SQLException - if a database access error occurs or the conditionseconds >= 0 is not satisfied |
setResultSetConcurrency | public void setResultSetConcurrency(int value) throws SQLException(Code) | | Parameters: value - an int value exception: SQLException - if an error occurs |
setResultSetType | public void setResultSetType(int value) throws SQLException(Code) | | Parameters: value - an int value exception: SQLException - if an error occurs |
|
|