Statement (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
void
[addBatch](../../java/sql/Statement.html#addBatch-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") sql)
Adds the given SQL command to the current list of commands for thisStatement
object.
void
[cancel](../../java/sql/Statement.html#cancel--)()
Cancels this Statement
object if both the DBMS and driver support aborting an SQL statement.
void
[clearBatch](../../java/sql/Statement.html#clearBatch--)()
Empties this Statement
object's current list of SQL commands.
void
[clearWarnings](../../java/sql/Statement.html#clearWarnings--)()
Clears all the warnings reported on this Statement
object.
void
[close](../../java/sql/Statement.html#close--)()
Releases this Statement
object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
void
[closeOnCompletion](../../java/sql/Statement.html#closeOnCompletion--)()
Specifies that this Statement
will be closed when all its dependent result sets are closed.
boolean
[execute](../../java/sql/Statement.html#execute-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") sql)
Executes the given SQL statement, which may return multiple results.
boolean
[execute](../../java/sql/Statement.html#execute-java.lang.String-int-)([String](../../java/lang/String.html "class in java.lang") 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.
boolean
[execute](../../java/sql/Statement.html#execute-java.lang.String-int:A-)([String](../../java/lang/String.html "class in java.lang") 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.
boolean
[execute](../../java/sql/Statement.html#execute-java.lang.String-java.lang.String:A-)([String](../../java/lang/String.html "class in java.lang") sql,[String](../../java/lang/String.html "class in java.lang")[] 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.
int[]
[executeBatch](../../java/sql/Statement.html#executeBatch--)()
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
default long[]
[executeLargeBatch](../../java/sql/Statement.html#executeLargeBatch--)()
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
default long
[executeLargeUpdate](../../java/sql/Statement.html#executeLargeUpdate-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") sql)
Executes the given SQL statement, which may be an INSERT
,UPDATE
, or DELETE
statement or an SQL statement that returns nothing, such as an SQL DDL statement.
default long
[executeLargeUpdate](../../java/sql/Statement.html#executeLargeUpdate-java.lang.String-int-)([String](../../java/lang/String.html "class in java.lang") 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.
default long
[executeLargeUpdate](../../java/sql/Statement.html#executeLargeUpdate-java.lang.String-int:A-)([String](../../java/lang/String.html "class in java.lang") 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 long
[executeLargeUpdate](../../java/sql/Statement.html#executeLargeUpdate-java.lang.String-java.lang.String:A-)([String](../../java/lang/String.html "class in java.lang") sql,[String](../../java/lang/String.html "class in java.lang")[] 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.
[ResultSet](../../java/sql/ResultSet.html "interface in java.sql")
[executeQuery](../../java/sql/Statement.html#executeQuery-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") sql)
Executes the given SQL statement, which returns a singleResultSet
object.
int
[executeUpdate](../../java/sql/Statement.html#executeUpdate-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") sql)
Executes the given SQL statement, which may be an INSERT
,UPDATE
, or DELETE
statement or an SQL statement that returns nothing, such as an SQL DDL statement.
int
[executeUpdate](../../java/sql/Statement.html#executeUpdate-java.lang.String-int-)([String](../../java/lang/String.html "class in java.lang") 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.
int
[executeUpdate](../../java/sql/Statement.html#executeUpdate-java.lang.String-int:A-)([String](../../java/lang/String.html "class in java.lang") 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.
int
[executeUpdate](../../java/sql/Statement.html#executeUpdate-java.lang.String-java.lang.String:A-)([String](../../java/lang/String.html "class in java.lang") sql,[String](../../java/lang/String.html "class in java.lang")[] 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.
[Connection](../../java/sql/Connection.html "interface in java.sql")
[getConnection](../../java/sql/Statement.html#getConnection--)()
Retrieves the Connection
object that produced this Statement
object.
int
[getFetchDirection](../../java/sql/Statement.html#getFetchDirection--)()
Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement
object.
int
[getFetchSize](../../java/sql/Statement.html#getFetchSize--)()
Retrieves the number of result set rows that is the default fetch size for ResultSet
objects generated from this Statement
object.
[ResultSet](../../java/sql/ResultSet.html "interface in java.sql")
[getGeneratedKeys](../../java/sql/Statement.html#getGeneratedKeys--)()
Retrieves any auto-generated keys created as a result of executing thisStatement
object.
default long
[getLargeMaxRows](../../java/sql/Statement.html#getLargeMaxRows--)()
Retrieves the maximum number of rows that aResultSet
object produced by thisStatement
object can contain.
default long
[getLargeUpdateCount](../../java/sql/Statement.html#getLargeUpdateCount--)()
Retrieves the current result as an update count; if the result is a ResultSet
object or there are no more results, -1 is returned.
int
[getMaxFieldSize](../../java/sql/Statement.html#getMaxFieldSize--)()
Retrieves the maximum number of bytes that can be returned for character and binary column values in a ResultSet
object produced by this Statement
object.
int
[getMaxRows](../../java/sql/Statement.html#getMaxRows--)()
Retrieves the maximum number of rows that aResultSet
object produced by thisStatement
object can contain.
boolean
[getMoreResults](../../java/sql/Statement.html#getMoreResults--)()
Moves to this Statement
object's next result, returnstrue
if it is a ResultSet
object, and implicitly closes any current ResultSet
object(s) obtained with the method getResultSet
.
boolean
[getMoreResults](../../java/sql/Statement.html#getMoreResults-int-)(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 returnstrue
if the next result is a ResultSet
object.
int
[getQueryTimeout](../../java/sql/Statement.html#getQueryTimeout--)()
Retrieves the number of seconds the driver will wait for a Statement
object to execute.
[ResultSet](../../java/sql/ResultSet.html "interface in java.sql")
[getResultSet](../../java/sql/Statement.html#getResultSet--)()
Retrieves the current result as a ResultSet
object.
int
[getResultSetConcurrency](../../java/sql/Statement.html#getResultSetConcurrency--)()
Retrieves the result set concurrency for ResultSet
objects generated by this Statement
object.
int
[getResultSetHoldability](../../java/sql/Statement.html#getResultSetHoldability--)()
Retrieves the result set holdability for ResultSet
objects generated by this Statement
object.
int
[getResultSetType](../../java/sql/Statement.html#getResultSetType--)()
Retrieves the result set type for ResultSet
objects generated by this Statement
object.
int
[getUpdateCount](../../java/sql/Statement.html#getUpdateCount--)()
Retrieves the current result as an update count; if the result is a ResultSet
object or there are no more results, -1 is returned.
[SQLWarning](../../java/sql/SQLWarning.html "class in java.sql")
[getWarnings](../../java/sql/Statement.html#getWarnings--)()
Retrieves the first warning reported by calls on this Statement
object.
boolean
[isClosed](../../java/sql/Statement.html#isClosed--)()
Retrieves whether this Statement
object has been closed.
boolean
[isCloseOnCompletion](../../java/sql/Statement.html#isCloseOnCompletion--)()
Returns a value indicating whether this Statement
will be closed when all its dependent result sets are closed.
boolean
[isPoolable](../../java/sql/Statement.html#isPoolable--)()
Returns a value indicating whether the Statement
is poolable or not.
void
[setCursorName](../../java/sql/Statement.html#setCursorName-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") name)
Sets the SQL cursor name to the given String
, which will be used by subsequent Statement
objectexecute
methods.
void
[setEscapeProcessing](../../java/sql/Statement.html#setEscapeProcessing-boolean-)(boolean enable)
Sets escape processing on or off.
void
[setFetchDirection](../../java/sql/Statement.html#setFetchDirection-int-)(int direction)
Gives the driver a hint as to the direction in which rows will be processed in ResultSet
objects created using this Statement
object.
void
[setFetchSize](../../java/sql/Statement.html#setFetchSize-int-)(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 forResultSet
objects generated by this Statement
.
default void
[setLargeMaxRows](../../java/sql/Statement.html#setLargeMaxRows-long-)(long max)
Sets the limit for the maximum number of rows that anyResultSet
object generated by this Statement
object can contain to the given number.
void
[setMaxFieldSize](../../java/sql/Statement.html#setMaxFieldSize-int-)(int max)
Sets the limit for the maximum number of bytes that can be returned for character and binary column values in a ResultSet
object produced by this Statement
object.
void
[setMaxRows](../../java/sql/Statement.html#setMaxRows-int-)(int max)
Sets the limit for the maximum number of rows that anyResultSet
object generated by this Statement
object can contain to the given number.
void
[setPoolable](../../java/sql/Statement.html#setPoolable-boolean-)(boolean poolable)
Requests that a Statement
be pooled or not pooled.
void
[setQueryTimeout](../../java/sql/Statement.html#setQueryTimeout-int-)(int seconds)
Sets the number of seconds the driver will wait for aStatement
object to execute to the given number of seconds.