The object used for executing a static SQL statement and returning the results it produces.
By default, only one ResultSet
object per Statement
object can be open at the same time. Therefore, if the reading of one
ResultSet
object is interleaved
with the reading of another, each must have been generated by
different Statement
objects. All execution methods in the
Statement
interface implicitly close a current
ResultSet
object of the statement if an open one exists.
Connection#createStatement
, ResultSet
Modifier and Type | Field and Description |
---|---|
public static final int | CLOSE_ALL_RESULTS
The constant indicating that all |
public static final int | CLOSE_CURRENT_RESULT
The constant indicating that the current |
public static final int | EXECUTE_FAILED
The constant indicating that an error occurred while executing a batch statement. |
public static final int | KEEP_CURRENT_RESULT
The constant indicating that the current |
public static final int | NO_GENERATED_KEYS
The constant indicating that generated keys should not be made available for retrieval. |
public static final int | RETURN_GENERATED_KEYS
The constant indicating that generated keys should be made available for retrieval. |
public static final int | SUCCESS_NO_INFO
The constant indicating that a batch statement executed successfully but that no count of the number of rows it affected is available. |
Modifier and Type | Method and Description |
---|---|
public void | |
public void | cancel()
Cancels this |
public void | |
public void | |
public void | close()
Redeclares java. Statement object's database
and JDBC resources immediately instead of waiting for
this to happen when it is automatically closed.
|
public void | closeOnCompletion()
Specifies that this |
public default String | Returns: A simple SQL identifier or a delimited identifiera SQL identifier identifier, boolean indicates if a simple SQL identifier should be
returned as a quoted identifier alwaysQuote)Returns a SQL identifier. |
public default String | Returns: A string enclosed by single quotes with every single quote converted to two single quotesa character string val)Returns a |
public default String | Returns: the result of replacing every single quote character in the argument by two single quote characters where this entire result is then prefixed with 'N'.a character string val)Returns a |
public boolean | |
public boolean | Returns: true if the first result is a ResultSet
object; false if it is an update count or there are
no resultsany SQL statement sql, int a constant indicating whether auto-generated
keys should be made available for retrieval using the method
autoGeneratedKeys)getGeneratedKeys ; one of the following constants:
Statement.RETURN_GENERATED_KEYS or
Statement.NO_GENERATED_KEYS 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 | Returns: true if the first result is a ResultSet
object; false if it is an update count or there
are no resultsany SQL statement sql, int[] an array of the indexes of the columns in the
inserted row that should be made available for retrieval by a
call to the method columnIndexes)getGeneratedKeys 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 | Returns: true if the next result is a ResultSet
object; false if it is an update count or there
are no more resultsany SQL statement sql, String[] an array of the names of the columns in the inserted
row that should be made available for retrieval by a call to the
method columnNames)getGeneratedKeys 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[] | Returns: an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. |
public default long[] | Returns: an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. |
public default long | Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothingan SQL Data Manipulation Language (DML) statement,
such as sql)INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.Executes the given SQL statement, which may be an |
public default long | Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothingan SQL Data Manipulation Language (DML) statement,
such as sql, int INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.a flag indicating whether auto-generated keys
should be made available for retrieval;
one of the following constants:
autoGeneratedKeys)Statement.RETURN_GENERATED_KEYS
Statement.NO_GENERATED_KEYS Executes the given SQL statement and signals the driver with the
given flag about whether the
auto-generated keys produced by this |
public default long | Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothingan SQL Data Manipulation Language (DML) statement,
such as sql, int[] INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.an array of column indexes indicating the columns
that should be returned from the inserted row 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 default long | Returns: either the row count forINSERT , UPDATE ,
or DELETE statements, or 0 for SQL statements
that return nothingan SQL Data Manipulation Language (DML) statement,
such as sql, String[] INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.an array of the names of the columns that should be
returned from the inserted row 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 ResultSet | Returns: aResultSet object that contains the data produced
by the given query; never null an SQL statement to be sent to the database, typically a
static SQL sql)SELECT statementExecutes the given SQL statement, which returns a single
|
public int | Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothingan SQL Data Manipulation Language (DML) statement, such as sql)INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.Executes the given SQL statement, which may be an |
public int | Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothingan SQL Data Manipulation Language (DML) statement, such as sql, int INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.a flag indicating whether auto-generated keys
should be made available for retrieval;
one of the following constants:
autoGeneratedKeys)Statement.RETURN_GENERATED_KEYS
Statement.NO_GENERATED_KEYS Executes the given SQL statement and signals the driver with the
given flag about whether the
auto-generated keys produced by this |
public int | Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothingan SQL Data Manipulation Language (DML) statement, such as sql, int[] INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.an array of column indexes indicating the columns
that should be returned from the inserted row 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 | Returns: either the row count forINSERT , UPDATE ,
or DELETE statements, or 0 for SQL statements
that return nothingan SQL Data Manipulation Language (DML) statement, such as sql, String[] INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement.an array of the names of the columns that should be
returned from the inserted row 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 | Returns: the connection that produced this statementRetrieves the |
public int | Returns: the default fetch direction for result sets generated from thisStatement objectRetrieves the direction for fetching rows from
database tables that is the default for result sets
generated from this |
public int | Returns: the default fetch size for result sets generated from thisStatement objectRetrieves the number of result set rows that is the default
fetch size for |
public ResultSet | Returns: aResultSet object containing the auto-generated key(s)
generated by the execution of this Statement objectRetrieves any auto-generated keys created as a result of executing this
|
public default long | Returns: the current maximum number of rows for aResultSet
object produced by this Statement object;
zero means there is no limitRetrieves the maximum number of rows that a
|
public default long | Returns: the current result as an update count; -1 if the current result is aResultSet object or there are no more resultsRetrieves the current result as an update count; if the result
is a |
public int | Returns: the current column size limit for columns storing character and binary values; zero means there is no limitRetrieves the maximum number of bytes that can be
returned for character and binary column values in a |
public int | Returns: the current maximum number of rows for aResultSet
object produced by this Statement object;
zero means there is no limitRetrieves the maximum number of rows that a
|
public boolean | Returns: true if the next result is a ResultSet
object; false if it is an update count or there are
no more resultsMoves to this |
public boolean | Returns: true if the next result is a ResultSet
object; false if it is an update count or there are no
more resultsone of the following current)Statement
constants indicating what should happen to current
ResultSet objects obtained using the method
getResultSet :
Statement.CLOSE_CURRENT_RESULT ,
Statement.KEEP_CURRENT_RESULT , or
Statement.CLOSE_ALL_RESULTS Moves to this |
public int | Returns: the current query timeout limit in seconds; zero means there is no limitRetrieves the number of seconds the driver will
wait for a |
public ResultSet | Returns: the current result as aResultSet object or
null if the result is an update count or there are no more resultsRetrieves the current result as a |
public int | Returns: eitherResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLE Retrieves the result set concurrency for |
public int | Returns: eitherResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT Retrieves the result set holdability for |
public int | Returns: one ofResultSet.TYPE_FORWARD_ONLY ,
ResultSet.TYPE_SCROLL_INSENSITIVE , or
ResultSet.TYPE_SCROLL_SENSITIVE Retrieves the result set type for |
public int | Returns: the current result as an update count; -1 if the current result is aResultSet object or there are no more resultsRetrieves the current result as an update count;
if the result is a |
public SQLWarning | Returns: the firstSQLWarning object or null
if there are no warningsRetrieves the first warning reported by calls on this |
public boolean | Returns: true if thisStatement object is closed; false if it is still openRetrieves whether this |
public boolean | Returns: true if the Statement will be closed when all
of its dependent result sets are closed; false otherwiseReturns a value indicating whether this |
public boolean | Returns: true if the Statement
is poolable; false otherwiseReturns a value indicating whether the |
public default boolean | Returns: true if a simple SQL identifier, false otherwisea SQL identifier identifier)Retrieves whether |
public void | setCursorName(String
the new cursor name, which must be unique within
a connection name)Sets the SQL cursor name to the given |
public void | setEscapeProcessing(boolean
true to enable escape processing;
false to disable itSets escape processing on or off. |
public void | setFetchDirection(int
the initial direction for processing rows direction)Gives the driver a hint as to the direction in which
rows will be processed in |
public void | setFetchSize(int
the number of rows to fetch rows)Gives the JDBC driver a hint as to the number of rows that should
be fetched from the database when more rows are needed for
|
public default void | setLargeMaxRows(long
the new max rows limit; zero means there is no limit max)Sets the limit for the maximum number of rows that any
|
public void | setMaxFieldSize(int
the new column size limit in bytes; zero means there is no limit max)Sets the limit for the maximum number of bytes that can be returned for
character and binary column values in a |
public void | setMaxRows(int
the new max rows limit; zero means there is no limit max)Sets the limit for the maximum number of rows that any
|
public void | setPoolable(boolean
requests that the statement be pooled if true and
that the statement not be pooled if false poolable)Requests that a |
public void | setQueryTimeout(int
the new query timeout limit in seconds; zero means
there is no limit seconds)Sets the number of seconds the driver will wait for a
|