Methods Summary |
---|
public void | addBatch(java.lang.String sql)Adds a specified SQL command to the list of commands for this {@code
Statement}.
The list of commands is executed by invoking the {@code executeBatch}
method.
|
public void | cancel()Cancels this statement's execution if both the database and the JDBC
driver support aborting an SQL statement in flight. This method can be
used by one thread to stop a statement that is executed on another
thread.
|
public void | clearBatch()Clears the current list of SQL commands for this statement.
|
public void | clearWarnings()Clears all {@code SQLWarnings} from this statement.
|
public void | close()Releases this statement's database and JDBC driver resources.
Using this method to release these resources as soon as possible is
strongly recommended.
One should not rely on the resources being automatically released when
finalized during garbage collection. Doing so can result in unpredictable
behavior for the application.
|
public boolean | execute(java.lang.String sql)Executes a supplied SQL statement. This may return multiple {@code
ResultSet}s.
Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
first result and {@code getMoreResults} to get any subsequent results.
|
public boolean | execute(java.lang.String sql, int autoGeneratedKeys)Executes a supplied SQL statement. This may return multiple {@code
ResultSet}s. This method allows control of whether auto-generated Keys
should be made available for retrieval, if the SQL statement is an
{@code INSERT} statement.
Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
first result and {@code getMoreResults} to get any subsequent results.
|
public boolean | execute(java.lang.String sql, int[] columnIndexes)Executes the supplied SQL statement. This may return multiple {@code
ResultSet}s. This method allows retrieval of auto generated keys
specified by the supplied array of column indexes, if the SQL statement
is an {@code INSERT} statement.
Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
first result and {@code getMoreResults} to get any subsequent results.
|
public boolean | execute(java.lang.String sql, java.lang.String[] columnNames)Executes the supplied SQL statement. This may return multiple {@code
ResultSet}s. This method allows retrieval of auto generated keys
specified by the supplied array of column indexes, if the SQL statement
is an {@code INSERT} statement.
Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
first result and {@code getMoreResults} to get any subsequent results.
|
public int[] | executeBatch()Submits a batch of SQL commands to the database. Returns an array of
update counts, if all the commands execute successfully.
If one of the commands in the batch fails, this method can throw a
{@link BatchUpdateException} and the JDBC driver may or may not process
the remaining commands. The JDBC driver must behave consistently with the
underlying database, following the "all or nothing" principle. If the
driver continues processing, the array of results returned contains the
same number of elements as there are commands in the batch, with a
minimum of one of the elements having the {@code EXECUTE_FAILED} value.
|
public java.sql.ResultSet | executeQuery(java.lang.String sql)Executes a supplied SQL statement. Returns a single {@code ResultSet}.
|
public int | executeUpdate(java.lang.String sql)Executes the supplied SQL statement. The statement may be an {@code
INSERT}, {@code UPDATE} or {@code DELETE} statement or a statement which
returns nothing.
|
public int | executeUpdate(java.lang.String sql, int autoGeneratedKeys)Executes the supplied SQL statement. This method allows control of
whether auto-generated Keys should be made available for retrieval.
|
public int | executeUpdate(java.lang.String sql, int[] columnIndexes)Executes the supplied SQL statement. This method allows retrieval of auto
generated keys specified by the supplied array of column indexes.
|
public int | executeUpdate(java.lang.String sql, java.lang.String[] columnNames)Executes the supplied SQL statement. This method allows retrieval of auto
generated keys specified by the supplied array of column names.
|
public java.sql.Connection | getConnection()Gets the {@code Connection} object which created this statement.
|
public int | getFetchDirection()Gets the default direction for fetching rows for {@code ResultSet}s
generated from this statement.
|
public int | getFetchSize()Gets the default number of rows for a fetch for the {@code ResultSet}
objects returned from this statement.
|
public java.sql.ResultSet | getGeneratedKeys()Returns auto generated keys created by executing this statement.
|
public int | getMaxFieldSize()Gets the maximum number of bytes which can be returned as values from
character and binary type columns in a {@code ResultSet} derived from this
statement. This limit applies to {@code BINARY}, {@code VARBINARY},
{@code LONGVARBINARY}, {@code CHAR}, {@code VARCHAR}, and {@code
LONGVARCHAR} types. Any data exceeding the maximum size is abandoned
without announcement.
|
public int | getMaxRows()Gets the maximum number of rows that a {@code ResultSet} can contain when
produced from this statement. If the limit is exceeded, the excess rows
are discarded silently.
|
public boolean | getMoreResults()Moves to this statement's next result. Returns {@code true} if it is a
{@code ResultSet}. Any current {@code ResultSet} objects previously
obtained with {@code getResultSet()} are closed implicitly.
|
public boolean | getMoreResults(int current)Moves to this statement's next result. Returns {@code true} if the next
result is a {@code ResultSet}. Any current {@code ResultSet} objects
previously obtained with {@code getResultSet()} are handled as indicated
by a supplied Flag parameter.
|
public int | getQueryTimeout()Gets the timeout value for the statement's execution time. The JDBC
driver will wait up to this value for the execution to complete - after
the limit is exceeded an SQL {@code Exception} is thrown.
|
public java.sql.ResultSet | getResultSet()Gets the current result. Should only be called once per result.
|
public int | getResultSetConcurrency()Gets the concurrency setting for {@code ResultSet} objects generated by
this statement.
|
public int | getResultSetHoldability()Gets the cursor hold setting for {@code ResultSet} objects generated by
this statement.
|
public int | getResultSetType()Gets the {@code ResultSet} type setting for {@code ResultSet}s derived
from this statement.
|
public int | getUpdateCount()Gets an update count for the current result if it is not a {@code
ResultSet}.
|
public java.sql.SQLWarning | getWarnings()Retrieves the first {@code SQLWarning} reported by calls on this
statement. If there are multiple warnings, subsequent warnings are
chained to the first one. The chain of warnings is cleared each time the
statement is executed.
Warnings associated with reads from the {@code ResultSet} returned from
executing the statement will be attached to the {@code ResultSet}, not the
statement object.
|
public void | setCursorName(java.lang.String name)Sets the SQL cursor name. This name is used by subsequent statement
execute methods.
Cursor names must be unique within one Connection.
With the cursor name set, it can then be used in SQL positioned
update or delete statements to determine the current row in a {@code
ResultSet} generated from this statement. The positioned update or delete
must be done with a different statement than this one.
|
public void | setEscapeProcessing(boolean enable)Sets Escape Processing mode.
If Escape Processing is on, the JDBC driver will do escape substitution
on an SQL statement before sending it for execution. This does not apply
to {@link PreparedStatement}s since they are processed when created,
before this method can be called.
|
public void | setFetchDirection(int direction)Sets the fetch direction - a hint to the JDBC driver about the direction
of processing of rows in {@code ResultSet}s created by this statement.
The default fetch direction is {@code FETCH_FORWARD}.
|
public void | setFetchSize(int rows)Sets the fetch size. This is a hint to the JDBC driver about how many
rows should be fetched from the database when more are required by
application processing.
|
public void | setMaxFieldSize(int max)Sets the maximum number of bytes for {@code ResultSet} columns that
contain character or binary values. This applies to {@code BINARY},
{@code VARBINARY}, {@code LONGVARBINARY}, {@code CHAR}, {@code VARCHAR},
and {@code LONGVARCHAR} fields. Any data exceeding the maximum size is
abandoned without announcement.
|
public void | setMaxRows(int max)Sets the maximum number of rows that any {@code ResultSet} can contain.
If the number of rows exceeds this value, the additional rows are
silently discarded.
|
public void | setQueryTimeout(int seconds)Sets the timeout, in seconds, for queries - how long the driver will
allow for completion of a statement execution. If the timeout is
exceeded, the query will throw an {@code SQLException}.
|