| java.lang.Object com.salmonllc.sql.DBStatement
DBStatement | public class DBStatement implements Statement(Code) | | This class serves as a wrapper around the standard java.sql.Statement. It behaves in the same way, except SQL Statements are written to the framework log file.
|
Method Summary | |
public void | addBatch(String sql) JDBC 2.0
Adds a SQL command to the current batch of commmands for the statement. | public void | cancel() Cancels this Statement object if both the DBMS and driver support aborting an SQL statement. | public void | clearBatch() JDBC 2.0 Makes the set of commands in the current batch empty. | public void | clearWarnings() Clears all the warnings reported on this Statement object. | public void | close() Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed. | public boolean | execute(String sql) Executes a SQL statement that may return multiple results. | 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() JDBC 2.0Submits a batch of commands to the database for execution. | public ResultSet | executeQuery(String sql) Executes a SQL statement that returns a single ResultSet. | public int | executeUpdate(String sql) Executes an 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.
This will compile in JDK 1.3 and 1.4. | 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. | public Connection | getConnection() | public int | getFetchDirection() JDBC 2.0
Retrieves the direction for fetching rows from
database tables that is the default for result sets
generated from this Statement object. | public int | getFetchSize() JDBC 2.0
Retrieves the number of result set rows that is the default
fetch size for result sets
generated from this Statement object. | public ResultSet | getGeneratedKeys() Retrieves any auto-generated keys created as a result of executing this
Statement object. | public int | getMaxFieldSize() Returns the maximum number of bytes allowed for any column value. | public int | getMaxRows() Returns the maximum number of bytes allowed for any column value. | public boolean | getMoreResults() Moves to a Statement's next result. | public boolean | getMoreResults(int current) Moves to this Statement object's next result, returns
true if it is a ResultSet object, and
implicitly closes any current ResultSet
object(s) obtained with the method getResultSet .
This will compile in JDK 1.3 and 1.4. | public int | getQueryTimeout() Retrieves the number of seconds the driver will wait for a Statement to execute. | public ResultSet | getResultSet() Returns the current result as a ResultSet object. | public int | getResultSetConcurrency() JDBC 2.0 Retrieves the result set concurrency. | public int | getResultSetHoldability() 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 occursThis will compile in JDK 1.3 and 1.4. | public int | getResultSetType() JDBC 2.0
Determine the result set type. | 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() Retrieves the first warning reported by calls on this Statement. | public void | setCursorName(String name) Defines the SQL cursor name that will be used by subsequent Statement execute methods. | public void | setEscapeProcessing(boolean enable) Sets escape processing on or off. | public void | setFetchDirection(int direction) JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed. | public void | setFetchSize(int rows) JDBC 2.0
Gives the JDBC driver a hint as to the number of rows that should
be fetched from the database when more rows are needed. | public void | setMaxFieldSize(int max) Sets the limit for the maximum number of bytes in a column to the given number of bytes. | public void | setMaxRows(int max) Retrieves the maximum number of rows that a ResultSet can contain. | public void | setQueryTimeout(int seconds) Retrieves the number of seconds the driver will wait for a Statement to execute. |
addBatch | public void addBatch(String sql) throws SQLException(Code) | | JDBC 2.0
Adds a SQL command to the current batch of commmands for the statement.
This method is optional.
Parameters: sql - typically this is a static SQL INSERT or UPDATE statement exception: SQLException - if a database access error occurs, or thedriver does not support batch statements |
cancel | public void cancel() throws SQLException(Code) | | Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.
|
clearBatch | public void clearBatch() throws SQLException(Code) | | JDBC 2.0 Makes the set of commands in the current batch empty.
|
clearWarnings | public void clearWarnings() throws SQLException(Code) | | Clears all the warnings reported on this Statement object.
|
close | public void close() throws SQLException(Code) | | Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
|
execute | public boolean execute(String sql) throws SQLException(Code) | | Executes a SQL statement that may return multiple results.
|
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).
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters: sql - any SQL statement Parameters: autoGeneratedKeys - a constant indicating whether auto-generatedkeys should 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: DBStatement.getResultSet See Also: DBStatement.getUpdateCount See Also: DBStatement.getMoreResults See Also: DBStatement.getGeneratedKeys since: 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).
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters: sql - any SQL statement Parameters: columnIndexes - an array of the indexes of the columns in theinserted row that should be made available for retrieval by acall to the method getGeneratedKeys true if the first result is a ResultSet object; false if it is an update count or thereare no results exception: SQLException - if a database access error occurs See Also: DBStatement.getResultSet See Also: DBStatement.getUpdateCount See Also: DBStatement.getMoreResults since: 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).
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters: sql - any SQL statement Parameters: columnNames - an array of the names of the columns in the insertedrow that 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 thereare no more results exception: SQLException - if a database access error occurs See Also: DBStatement.getResultSet See Also: DBStatement.getUpdateCount See Also: DBStatement.getMoreResults See Also: DBStatement.getGeneratedKeys since: 1.4 |
executeBatch | public int[] executeBatch() throws SQLException(Code) | | JDBC 2.0Submits a batch of commands to the database for execution. This method is optional.
an array of update counts containing one element for each command in the batch. The array is ordered according to the order in which commands were inserted into the batch. |
executeUpdate | public int executeUpdate(String sql) throws SQLException(Code) | | Executes an SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.
|
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.
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters: sql - must be an SQL INSERT , UPDATE orDELETE statement or an SQL statement thatreturns nothing Parameters: autoGeneratedKeys - a flag indicating whether auto-generated keysshould be made available for retrieval;one of the following constants:Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS either the row count for INSERT , UPDATE or DELETE statements, or 0 for SQLstatements that return nothing exception: SQLException - if a database access error occurs, the givenSQL statement returns a ResultSet object, orthe given constant is not one of those allowed since: 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.
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters: sql - an SQL INSERT , UPDATE orDELETE statement or an SQL statement that returns nothing,such as an SQL DDL statement Parameters: columnIndexes - an array of column indexes indicating the columnsthat should be returned from the inserted row either the row count for INSERT , UPDATE ,or DELETE statements, or 0 for SQL statementsthat return nothing exception: SQLException - if a database access error occurs or the SQLstatement returns a ResultSet object since: 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.
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters: sql - an SQL INSERT , UPDATE orDELETE statement or an SQL statement that returns nothing 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 0 for SQL statementsthat return nothing exception: SQLException - if a database access error occurs since: 1.4 |
getFetchDirection | public int getFetchDirection() throws SQLException(Code) | | JDBC 2.0
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 by calling the method setFetchDirection ,
the return value is implementation-specific.
the default fetch direction for result sets generatedfrom this Statement object exception: SQLException - if a database access error occurs |
getFetchSize | public int getFetchSize() throws SQLException(Code) | | JDBC 2.0
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 by calling the method setFetchSize ,
the return value is implementation-specific.
the default fetch size for result sets generatedfrom this Statement object exception: SQLException - if a database access error occurs |
getGeneratedKeys | public 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.
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
a ResultSet object containing the auto-generated key(s)generated by the execution of this Statement object exception: SQLException - if a database access error occurs since: 1.4 |
getMaxFieldSize | public int getMaxFieldSize() throws SQLException(Code) | | 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 BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.
|
getMaxRows | public int getMaxRows() throws SQLException(Code) | | 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 BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.
|
getMoreResults | public boolean getMoreResults() throws SQLException(Code) | | Moves to a Statement's next result. It returns true if this result is a ResultSet. This method also implicitly closes any current ResultSet obtained with getResultSet. There are no more results when (!getMoreResults() && (getUpdateCount() == -1)
|
getMoreResults | public boolean getMoreResults(int current) throws SQLException(Code) | | Moves to this Statement object's next result, returns
true if it is a ResultSet object, and
implicitly closes any current ResultSet
object(s) obtained with the method getResultSet .
This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
There are no more results when the following is true:
(!getMoreResults() && (getUpdateCount() == -1)
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: DBStatement.execute |
getQueryTimeout | public int getQueryTimeout() throws SQLException(Code) | | Retrieves the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.
|
getResultSet | public ResultSet getResultSet() throws SQLException(Code) | | Returns the current result as a ResultSet object. This method should be called only once per result.
|
getResultSetConcurrency | public int getResultSetConcurrency() throws java.sql.SQLException(Code) | | JDBC 2.0 Retrieves the result set concurrency.
|
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 occursThis will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM. since: 1.4 |
getResultSetType | public int getResultSetType() throws SQLException(Code) | | JDBC 2.0
Determine the result set type.
|
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. This method should be called only once per result.
|
getWarnings | public SQLWarning getWarnings() throws SQLException(Code) | | Retrieves the first warning reported by calls on this Statement. 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, any warnings associated with ResultSet reads will be chained on the ResultSet object.
|
setCursorName | public void setCursorName(String name) throws SQLException(Code) | | Defines the SQL cursor name that will be used by subsequent Statement execute methods.
|
setEscapeProcessing | public void setEscapeProcessing(boolean enable) throws SQLException(Code) | | Sets escape processing on or off. If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. Note: Since prepared statements have usually been parsed prior to making this call, disabling escape processing for prepared statements will have no effect.
|
setFetchDirection | public void setFetchDirection(int direction) throws SQLException(Code) | | JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. The default value is ResultSet.FETCH_FORWARD.
Note that this method sets the default fetch direction for result sets generated by this Statement object. Each result set has its own methods for getting and setting its own fetch direction.
|
setFetchSize | public void setFetchSize(int rows) throws SQLException(Code) | | JDBC 2.0
Gives the JDBC driver a hint as to the number of rows that should
be fetched from the database when more rows are needed. The number
of rows specified affects only result sets created using this
statement. If the value specified is zero, then the hint is ignored.
The default value is zero.
Parameters: rows - the number of rows to fetch exception: SQLException - if a database access error occurs, or thecondition 0 <= rows <= this.getMaxRows() is not satisfied. |
setMaxFieldSize | public void setMaxFieldSize(int max) throws SQLException(Code) | | Sets the limit for the maximum number of bytes in a column to the given number of bytes. This is the maximum number of bytes that can be returned for any column value. This limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. If the limit is exceeded, the excess data is silently discarded. For maximum portability, use values greater than 256.
|
setMaxRows | public void setMaxRows(int max) throws SQLException(Code) | | Retrieves the maximum number of rows that a ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.
|
setQueryTimeout | public void setQueryTimeout(int seconds) throws SQLException(Code) | | Retrieves the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.
|
|
|