|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Statement
Interface used for executing static SQL statements and returning their results. By default, an object implementing the Statement interface can returns results as ResultSets. For any given Statement object, only one ResultSet can be open at one time. A call to any of the execution methods of Statement will cause any previously created ResultSet object for that Statement to be closed implicitly.
To have multiple ResultSet objects open concurrently, multiple Statement objects must be used.
Field Summary | |
---|---|
static int |
CLOSE_ALL_RESULTS
Passing this constant to getMoreResults implies that all ResultSet objects previously kept open should be closed. |
static int |
CLOSE_CURRENT_RESULT
Passing this constant to getMoreResults implies that the current ResultSet object should be closed |
static int |
EXECUTE_FAILED
Indicates that an error was encountered during execution of a batch statement. |
static int |
KEEP_CURRENT_RESULT
Passing this constant to getMoreResults implies that the current ResultSet object should not be closed. |
static int |
NO_GENERATED_KEYS
Indicates that generated keys should not be accessible for retrieval. |
static int |
RETURN_GENERATED_KEYS
Indicates that generated keys should be accessible for retrieval. |
static int |
SUCCESS_NO_INFO
Indicates that a batch statement was executed with a successful result, but a count of the number of rows it affected is unavailable. |
Method Summary | |
---|---|
void |
addBatch(java.lang.String sql)
Adds a specified SQL commands to the list of commands for this Statement. |
void |
cancel()
Cancels this Statement execution if both the database and the JDBC driver support aborting an SQL statement in flight. |
void |
clearBatch()
Clears the current list of SQL commands for this Statement. |
void |
clearWarnings()
Clears all SQLWarnings from this Statement. |
void |
close()
Releases this Statement's database and JDBC driver resources. |
boolean |
execute(java.lang.String sql)
Executes a supplied SQL statement. |
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys)
Executes a supplied SQL statement. |
boolean |
execute(java.lang.String sql,
int[] columnIndexes)
Executes the supplied SQL statement. |
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames)
Executes the supplied SQL statement. |
int[] |
executeBatch()
Submits a batch of SQL commands to the database. |
ResultSet |
executeQuery(java.lang.String sql)
Executes a supplied SQL statement. |
int |
executeUpdate(java.lang.String sql)
Executes the supplied SQL statement. |
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
Executes the supplied SQL statement. |
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes)
Executes the supplied SQL statement. |
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
Executes the supplied SQL statement. |
Connection |
getConnection()
Gets the Connection that produced this Statement. |
int |
getFetchDirection()
Gets the default direction for fetching rows for ResultSets generated from this Statement. |
int |
getFetchSize()
Gets the default number of rows for a fetch for the ResultSet objects returned from this Statement. |
ResultSet |
getGeneratedKeys()
Returns auto generated keys created by executing this Statement. |
int |
getMaxFieldSize()
Gets the maximum number of bytes which can be returned for values from Character and Binary values in a ResultSet derived from this Statement. |
int |
getMaxRows()
Gets the maximum number of rows that a ResultSet can contain when produced from this Statement. |
boolean |
getMoreResults()
Moves to this Statement's next result. |
boolean |
getMoreResults(int current)
Moves to this Statement's next result. |
int |
getQueryTimeout()
Gets the timeout value for Statement execution. |
ResultSet |
getResultSet()
Gets the current result. |
int |
getResultSetConcurrency()
Gets the concurrency setting for ResultSet objects generated by this Statement. |
int |
getResultSetHoldability()
Gets the cursor hold setting for ResultSet objects generated by this Statement. |
int |
getResultSetType()
Gets the ResultSet type setting for ResultSets derived from this Statement. |
int |
getUpdateCount()
Gets an update count for the current result if it is not a ResultSet. |
SQLWarning |
getWarnings()
Retrieves the first SQLWarning reported by calls on this Statement. |
void |
setCursorName(java.lang.String name)
Sets the SQL cursor name. |
void |
setEscapeProcessing(boolean enable)
Sets Escape Processing mode. |
void |
setFetchDirection(int direction)
Sets the fetch direction - a hint to the JDBC driver about the direction of processing of rows in ResultSets created by this Statement. |
void |
setFetchSize(int rows)
Sets the fetch size. |
void |
setMaxFieldSize(int max)
Sets the maximum number of bytes for ResultSet columns that contain character or binary values. |
void |
setMaxRows(int max)
Sets the maximum number of rows that any ResultSet can contain. |
void |
setQueryTimeout(int seconds)
Sets the timeout, in seconds, for queries - how long the driver will allow for completion of a Statement execution. |
Field Detail |
---|
static final int CLOSE_ALL_RESULTS
static final int CLOSE_CURRENT_RESULT
static final int EXECUTE_FAILED
static final int KEEP_CURRENT_RESULT
static final int NO_GENERATED_KEYS
static final int RETURN_GENERATED_KEYS
static final int SUCCESS_NO_INFO
Method Detail |
---|
void addBatch(java.lang.String sql) throws SQLException
The list of commands is executed by invoking the executeBatch
method.
sql
- the SQL command as a String. Typically an INSERT or UPDATE statement.
SQLException
- if an error occurs accessing the database or the database does not support batch updatesvoid cancel() throws SQLException
SQLException
- if an error occurs accessing the databasevoid clearBatch() throws SQLException
SQLException
- if an error occurs accessing the database or the database does not support batch updatesvoid clearWarnings() throws SQLException
SQLException
- if an error occurs accessing the databasevoid close() throws SQLException
Using this method to release these resources as soon as possible is strongly recommended. It is not a good idea to rely on these resources being released when the Statement object is finalized during garbage collection. Doing so can result in unpredictable performance characteristics for the application.
SQLException
- if an error occurs accessing the databaseboolean execute(java.lang.String sql) throws SQLException
Use the getResultSet
or getUpdateCount
methods to get the first result and
getMoreResults
to get any subsequent results.
sql
- the SQL statement to execute
SQLException
- if an error occurs accessing the databaseboolean execute(java.lang.String sql, int autoGeneratedKeys) throws SQLException
Use the getResultSet
or getUpdateCount
methods to get the first result and
getMoreResults
to get any subsequent results.
sql
- the SQL statement to executeautoGeneratedKeys
- a flag indicating whether to make auto generated keys available for retrieval. This parameter must be one
of Statement.NO_GENERATED_KEYS or Statement.RETURN_GENERATED_KEYS
SQLException
- if an error occurs accessing the databaseboolean execute(java.lang.String sql, int[] columnIndexes) throws SQLException
Use the getResultSet
or getUpdateCount
methods to get the first result and
getMoreResults
to get any subsequent results.
sql
- the SQL statement to executecolumnIndexes
- an array of indexes of the columns in the inserted row which should be made available for retrieval via
the getGeneratedKeys
method.
SQLException
- if an error occurs accessing the databaseboolean execute(java.lang.String sql, java.lang.String[] columnNames) throws SQLException
Use the getResultSet
or getUpdateCount
methods to get the first result and
getMoreResults
to get any subsequent results.
sql
- the SQL statement to executecolumnNames
- an array of column names in the inserted row which should be made available for retrieval via the
getGeneratedKeys
method.
SQLException
- if an error occurs accessing the databaseint[] executeBatch() throws SQLException
If one of the commands in the batch fails, this method can throw a BatchUpdateException and the JDBC driver may or may not process the remaining commands. The JDBC driver must behave consistently with the underlying database, either always continuing or never continuing. 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 EXECUTE_FAILED value.
SQLException
- if an error occurs accessing the databaseResultSet executeQuery(java.lang.String sql) throws SQLException
sql
- an SQL statement to execute. Typically a SELECT statement
SQLException
- if an error occurs accessing the database or if the statement produces anything other than a single
ResultSetint executeUpdate(java.lang.String sql) throws SQLException
sql
- an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or a statement which returns nothing
SQLException
- if an error occurs accessing the database or if the statement produces a ResultSetint executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws SQLException
sql
- an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or a statement which does not return anything.autoGeneratedKeys
- a flag that indicates whether to allow retrieval of auto generated keys. Parameter must be one of
Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
SQLException
- if an error occurs accessing the database or if the statement produces a ResultSetint executeUpdate(java.lang.String sql, int[] columnIndexes) throws SQLException
sql
- an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or a statement which returns nothingcolumnIndexes
- an array of indexes of the columns in the inserted row which should be made available for retrieval via
the getGeneratedKeys
method.
SQLException
- if an error occurs accessing the database or if the statement produces a ResultSetint executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws SQLException
sql
- an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or a statement which returns nothingcolumnNames
- an array of column names in the inserted row which should be made available for retrieval via the
getGeneratedKeys
method.
SQLException
- if an error occurs accessing the database or if the statement produces a ResultSetConnection getConnection() throws SQLException
SQLException
- if an error occurs accessing the databaseint getFetchDirection() throws SQLException
SQLException
- if an error occurs accessing the databaseint getFetchSize() throws SQLException
SQLException
- if an error occurs accessing the databaseResultSet getGeneratedKeys() throws SQLException
SQLException
- if an error occurs accessing the databaseint getMaxFieldSize() throws SQLException
SQLException
- if an error occurs accessing the databaseint getMaxRows() throws SQLException
SQLException
- if an error occurs accessing the databaseboolean getMoreResults() throws SQLException
getResultSet()
are closed implicitly.
getUpdateCount
will return -1.
SQLException
- if an error occurs accessing the databaseboolean getMoreResults(int current) throws SQLException
getResultSet()
are handled as indicated by a supplied Flag parameter.
current
- a flag indicating what to do with existing ResultSets. This parameter must be one of
Statement.CLOSE_ALL_RESULTS, Statement.CLOSE_CURRENT_RESULT or Statement.KEEP_CURRENT_RESULT.
getUpdateCount
will return -1.
SQLException
- if an error occurs accessing the databaseint getQueryTimeout() throws SQLException
SQLException
- if an error occurs accessing the databaseResultSet getResultSet() throws SQLException
SQLException
- if an error occurs accessing the databaseint getResultSetConcurrency() throws SQLException
SQLException
- if an error occurs accessing the databaseint getResultSetHoldability() throws SQLException
SQLException
- if there is an error while accessing the databaseint getResultSetType() throws SQLException
SQLException
- if there is an error accessing the databaseint getUpdateCount() throws SQLException
SQLException
- if an error occurs accessing the databaseSQLWarning getWarnings() throws SQLException
If there are multiple warnings, subsequent warnings are chained to the first one.
The chain or warnings is cleared each time the Statement is executed.
Warnings associated with reads from the ResultSet returned from executing a Statement will be attached to the ResultSet, not the Statement object.
SQLException
- if an error occurs accessing the databasevoid setCursorName(java.lang.String name) throws SQLException
Cursor names must be unique within one Connection.
With the Cursor name set, it can then be utilized in SQL positioned update or delete statements to determine the current row in a ResultSet generated from this Statement. The positioned update or delete must be done with a different Statement than this one.
name
- the Cursor name as a String,
SQLException
- if an error occurs accessing the databasevoid setEscapeProcessing(boolean enable) throws SQLException
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 PreparedStatements since they are processed when created, before this method can be called.
enable
- true to set escape processing mode on, false to turn it off.
SQLException
- if an error occurs accessing the databasevoid setFetchDirection(int direction) throws SQLException
direction
- which fetch direction to use. This parameter should be one of ResultSet.FETCH_UNKNOWN,
ResultSet.FETCH_FORWARD or ResultSet.FETCH_REVERSE
SQLException
- if there is an error while accessing the database or if the fetch direction is unrecognizedvoid setFetchSize(int rows) throws SQLException
rows
- the number of rows that should be fetched. 0 tells the driver to ignore the hint. Should be less than
getMaxRows
for this statement. Should not be negative.
SQLException
- if an error occurs accessing the database, or if the rows parameter is out of range.void setMaxFieldSize(int max) throws SQLException
max
- the maximum field size in bytes. O means "no limit".
SQLException
- if an error occurs accessing the database or the max value is <0.void setMaxRows(int max) throws SQLException
max
- the maximum number of rows. 0 means "no limit".
SQLException
- if an error occurs accessing the database or if max <0.void setQueryTimeout(int seconds) throws SQLException
seconds
- timeout in seconds. 0 means no timeout ("wait forever")
SQLException
- if an error occurs accessing the database or if seconds <0.
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |