Statement (Java SE 24 & JDK 24)
- All Superinterfaces:
AutoCloseable,Wrapper
- All Known Subinterfaces:
CallableStatement,PreparedStatement
-
Field Summary
Fields
static final intThe constant indicating that all
ResultSetobjects that have previously been kept open should be closed when callinggetMoreResults.static final intThe constant indicating that the current
ResultSetobject should be closed when callinggetMoreResults.static final intThe constant indicating that an error occurred while executing a batch statement.
static final intThe constant indicating that the current
ResultSetobject should not be closed when callinggetMoreResults.static final intThe constant indicating that generated keys should not be made available for retrieval.
static final intThe constant indicating that generated keys should be made available for retrieval.
static final intThe constant indicating that a batch statement executed successfully but that no count of the number of rows it affected is available.
-
Method Summary
voidAdds the given SQL command to the current list of commands for this
Statementobject.voidcancel()Cancels this
Statementobject if both the DBMS and driver support aborting an SQL statement.voidEmpties this
Statementobject's current list of SQL commands.voidClears all the warnings reported on this
Statementobject.voidclose()Releases this
Statementobject's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.voidSpecifies that this
Statementwill be closed when all its dependent result sets are closed.enquoteIdentifier(String identifier, boolean alwaysQuote) Returns a SQL identifier.
Returns a
Stringenclosed in single quotes.Returns a
Stringrepresenting a National Character Set Literal enclosed in single quotes and prefixed with a upper case letter N.booleanExecutes the given SQL statement, which may return multiple results.
booleanexecute(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.
booleanexecute(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.
booleanExecutes 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.
int[]Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
default long[]Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
default longExecutes the given SQL statement, which may be an
INSERT,UPDATE, orDELETEstatement or an SQL statement that returns nothing, such as an SQL DDL statement.default longexecuteLargeUpdate(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
Statementobject should be made available for retrieval.default longexecuteLargeUpdate(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.
default longExecutes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
Executes the given SQL statement, which returns a single
ResultSetobject.intExecutes the given SQL statement, which may be an
INSERT,UPDATE, orDELETEstatement or an SQL statement that returns nothing, such as an SQL DDL statement.intexecuteUpdate(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
Statementobject should be made available for retrieval.intexecuteUpdate(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.
intExecutes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
Retrieves the
Connectionobject that produced thisStatementobject.intRetrieves the direction for fetching rows from database tables that is the default for result sets generated from this
Statementobject.intRetrieves the number of result set rows that is the default fetch size for
ResultSetobjects generated from thisStatementobject.Retrieves any auto-generated keys created as a result of executing this
Statementobject.default longRetrieves the maximum number of rows that a
ResultSetobject produced by thisStatementobject can contain.default longRetrieves the current result as an update count; if the result is a
ResultSetobject or there are no more results, -1 is returned.intRetrieves the maximum number of bytes that can be returned for character and binary column values in a
ResultSetobject produced by thisStatementobject.intRetrieves the maximum number of rows that a
ResultSetobject produced by thisStatementobject can contain.booleanMoves to this
Statementobject's next result, returnstrueif it is aResultSetobject, and implicitly closes any currentResultSetobject(s) obtained with the methodgetResultSet.booleangetMoreResults(int current) Moves to this
Statementobject's next result, deals with any currentResultSetobject(s) according to the instructions specified by the given flag, and returnstrueif the next result is aResultSetobject.intRetrieves the number of seconds the driver will wait for a
Statementobject to execute.Retrieves the current result as a
ResultSetobject.intRetrieves the result set concurrency for
ResultSetobjects generated by thisStatementobject.intRetrieves the result set holdability for
ResultSetobjects generated by thisStatementobject.intRetrieves the result set type for
ResultSetobjects generated by thisStatementobject.intRetrieves the current result as an update count; if the result is a
ResultSetobject or there are no more results, -1 is returned.Retrieves the first warning reported by calls on this
Statementobject.booleanisClosed()Retrieves whether this
Statementobject has been closed.booleanReturns a value indicating whether this
Statementwill be closed when all its dependent result sets are closed.booleanReturns a value indicating whether the
Statementis poolable or not.default booleanRetrieves whether
identifieris a simple SQL identifier.voidSets the SQL cursor name to the given
String, which will be used by subsequentStatementobjectexecutemethods.voidsetEscapeProcessing(boolean enable) Sets escape processing on or off.
voidsetFetchDirection(int direction) Gives the driver a hint as to the direction in which rows will be processed in
ResultSetobjects created using thisStatementobject.voidsetFetchSize(int 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
ResultSetobjects generated by thisStatement.default voidsetLargeMaxRows(long max) Sets the limit for the maximum number of rows that any
ResultSetobject generated by thisStatementobject can contain to the given number.voidsetMaxFieldSize(int max) Sets the limit for the maximum number of bytes that can be returned for character and binary column values in a
ResultSetobject produced by thisStatementobject.voidsetMaxRows(int max) Sets the limit for the maximum number of rows that any
ResultSetobject generated by thisStatementobject can contain to the given number.voidsetPoolable(boolean poolable) Requests that a
Statementbe pooled or not pooled.voidsetQueryTimeout(int seconds) Sets the number of seconds the driver will wait for a
Statementobject to execute to the given number of seconds.
-
Field Details
-
CLOSE_CURRENT_RESULT
-
KEEP_CURRENT_RESULT
-
CLOSE_ALL_RESULTS
-
SUCCESS_NO_INFO
-
EXECUTE_FAILED
-
RETURN_GENERATED_KEYS
-
NO_GENERATED_KEYS
-
-
Method Details
-
executeQuery
-
executeUpdate
-
close
-
getMaxFieldSize
-
setMaxFieldSize
-
getMaxRows
-
setMaxRows
-
setEscapeProcessing
-
getQueryTimeout
-
setQueryTimeout
-
cancel
-
getWarnings
-
clearWarnings
-
setCursorName
-
execute
-
getResultSet
-
getUpdateCount
-
getMoreResults
-
setFetchDirection
-
getFetchDirection
-
setFetchSize
-
getFetchSize
-
getResultSetConcurrency
-
getResultSetType
-
addBatch
-
clearBatch
-
executeBatch
-
getConnection
-
getMoreResults
-
getGeneratedKeys
-
executeUpdate
-
executeUpdate
-
executeUpdate
-
execute
-
execute
-
execute
-
getResultSetHoldability
-
isClosed
-
setPoolable
-
isPoolable
-
closeOnCompletion
-
isCloseOnCompletion
-
getLargeUpdateCount
-
setLargeMaxRows
-
getLargeMaxRows
-
executeLargeBatch
-
executeLargeUpdate
-
executeLargeUpdate
-
executeLargeUpdate
-
executeLargeUpdate
-
enquoteLiteral
-
enquoteIdentifier
-
isSimpleIdentifier
-
enquoteNCharLiteral
-