public class DBStatementCluster extends DBStatement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Constructor and Description |
|---|
DBStatementCluster(DBDatabaseCluster db) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBatch(String string)
Adds the given SQL command to the current list of commands for this
Statement object.
|
void |
cancel()
Cancels this Statement object if both the DBMS and driver support aborting
an SQL statement.
|
void |
clearBatch()
Empties this Statement object's current list of SQL commands.
|
void |
clearWarnings()
Clears all the warnings reported on this Statement object.
|
void |
close()
Closes the Statement and the Connection.
|
boolean |
execute(String sql)
Executes the given SQL statement, which may return multiple results.
|
boolean |
execute(String string,
int i)
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(String string,
int[] ints)
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(String string,
String[] strings)
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()
Submits a batch of commands to the database for execution and if all
commands execute successfully, returns an array of update counts.
|
ResultSet |
executeQuery(String string)
Executes the given SQL statement, which returns a single ResultSet object.
|
int |
executeUpdate(String string)
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(String string,
int i)
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(String string,
int[] ints)
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(String string,
String[] strings)
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.
|
boolean |
getBatchHasEntries()
Indicates that a batch has been added.
|
Connection |
getConnection()
Retrieves the Connection object that produced this Statement object.
|
int |
getFetchDirection()
Retrieves the direction for fetching rows from database tables that is the
default for result sets generated from this Statement object.
|
int |
getFetchSize()
Retrieves the number of result set rows that is the default fetch size for
ResultSet objects generated from this Statement object.
|
ResultSet |
getGeneratedKeys()
Retrieves any auto-generated keys created as a result of executing this
Statement object.
|
int |
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()
Retrieves the maximum number of rows that a ResultSet object produced by
this Statement object can contain.
|
boolean |
getMoreResults()
Moves to this Statement object's next result, returns true if it is a
ResultSet object, and implicitly closes any current ResultSet object(s)
obtained with the method getResultSet.
|
boolean |
getMoreResults(int i)
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 returns true if the next result is a ResultSet object.
|
int |
getQueryTimeout()
Retrieves the number of seconds the driver will wait for a Statement object
to execute.
|
ResultSet |
getResultSet()
Retrieves the current result as a ResultSet object.
|
int |
getResultSetConcurrency()
Retrieves the result set concurrency for ResultSet objects generated by
this Statement object.
|
int |
getResultSetType()
Retrieves the result set type for ResultSet objects generated by this
Statement object.
|
int |
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 |
getWarnings()
Retrieves the first warning reported by calls on this Statement object.
|
boolean |
isPoolable()
Returns a value indicating whether the Statement is poolable or not.
|
protected void |
replaceBrokenConnection()
Discards the current connection, replaces it, and creates a new statement.
|
void |
setCursorName(String string)
Sets the SQL cursor name to the given String, which will be used by
subsequent Statement object execute methods.
|
void |
setEscapeProcessing(boolean bln)
Sets escape processing on or off.
|
void |
setFetchDirection(int i)
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(int i)
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 ResultSet objects
generated by this Statement.
|
void |
setMaxFieldSize(int i)
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(int i)
Sets the limit for the maximum number of rows that any ResultSet object
generated by this Statement object can contain to the given number.
|
void |
setQueryTimeout(int i)
Sets the number of seconds the driver will wait for a Statement object to
execute to the given number of seconds.
|
closeOnCompletion, getInternalStatement, getResultSetHoldability, isClosed, isCloseOnCompletion, isWrapperFor, setInternalStatement, setPoolable, unwrappublic DBStatementCluster(DBDatabaseCluster db) throws SQLException
SQLExceptionpublic boolean getBatchHasEntries()
DBStatementSupport DBvolution at Patreon
getBatchHasEntries in class DBStatementpublic boolean isPoolable()
throws SQLException
DBStatementSupport DBvolution at Patreon
isPoolable in interface StatementisPoolable in class DBStatementSQLException - java.sql.SQLExceptionpublic boolean execute(String string, String[] strings) throws SQLException
DBStatementThis array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific). In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
execute in interface Statementexecute in class DBStatementstring - stringstrings - strings
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic boolean execute(String string, int[] ints) throws SQLException
DBStatementThis array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific). Under some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
execute in interface Statementexecute in class DBStatementstring - stringints - ints
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic boolean execute(String string, int i) throws SQLException
DBStatementThe driver will ignore this signal if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific). In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
execute in interface Statementexecute in class DBStatementstring - stringi - i
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic int executeUpdate(String string, String[] strings) throws SQLException
DBStatementThis array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).
executeUpdate in interface StatementexecuteUpdate in class DBStatementstring - stringstrings - strings
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic int executeUpdate(String string, int[] ints) throws SQLException
DBStatementThis array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).
executeUpdate in interface StatementexecuteUpdate in class DBStatementstring - stringints - ints
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic int executeUpdate(String string, int i) throws SQLException
DBStatementThe driver will ignore the flag if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).
executeUpdate in interface StatementexecuteUpdate in class DBStatementstring - stringi - i
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic ResultSet getGeneratedKeys() throws SQLException
DBStatementIf this Statement object did not generate any keys, an empty ResultSet object is returned.
Support DBvolution at Patreon
getGeneratedKeys in interface StatementgetGeneratedKeys in class DBStatementSQLException - java.sql.SQLExceptionpublic boolean getMoreResults(int i)
throws SQLException
DBStatementThere are no more results when the following is true:
(statement.getMoreResults(current) == false)
&& (statement.getUpdateCount() == -1))
getMoreResults in interface StatementgetMoreResults in class DBStatementi - i
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic Connection getConnection() throws SQLException
DBStatementSupport DBvolution at Patreon
getConnection in interface StatementgetConnection in class DBStatementSQLException - java.sql.SQLExceptionpublic int[] executeBatch()
throws SQLException
DBStatementThe int elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeBatch may be one of the following:
If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be a value of EXECUTE_FAILED.
The possible implementations and return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to process commands in a batch update after a BatchUpdateException object has been thrown.
Support DBvolution at Patreon
executeBatch in interface StatementexecuteBatch in class DBStatementSQLException - java.sql.SQLExceptionpublic void clearBatch()
throws SQLException
DBStatementclearBatch in interface StatementclearBatch in class DBStatementSQLException - java.sql.SQLExceptionpublic void addBatch(String string) throws SQLException
DBStatementaddBatch in interface StatementaddBatch in class DBStatementstring - stringSQLException - java.sql.SQLExceptionpublic int getResultSetType()
throws SQLException
DBStatementSupport DBvolution at Patreon
getResultSetType in interface StatementgetResultSetType in class DBStatementSQLException - java.sql.SQLExceptionpublic int getResultSetConcurrency()
throws SQLException
DBStatementSupport DBvolution at Patreon
getResultSetConcurrency in interface StatementgetResultSetConcurrency in class DBStatementSQLException - java.sql.SQLExceptionpublic int getFetchSize()
throws SQLException
DBStatementIf this Statement object has not set a fetch size by calling the method setFetchSize, the return value is implementation-specific.
Support DBvolution at Patreon
getFetchSize in interface StatementgetFetchSize in class DBStatementSQLException - java.sql.SQLExceptionpublic void setFetchSize(int i)
throws SQLException
DBStatementIf the value specified is zero, then the hint is ignored. The default value is zero. 1 Database exceptions may be thrown
setFetchSize in interface StatementsetFetchSize in class DBStatementi - iSQLException - java.sql.SQLExceptionpublic int getFetchDirection()
throws SQLException
DBStatementIf this Statement object has not set a fetch direction by calling the method setFetchDirection, the return value is implementation-specific.
Support DBvolution at Patreon
getFetchDirection in interface StatementgetFetchDirection in class DBStatementSQLException - java.sql.SQLExceptionpublic void setFetchDirection(int i)
throws SQLException
DBStatementThe default value is ResultSet.FETCH_FORWARD. 1 Database exceptions may be thrown
setFetchDirection in interface StatementsetFetchDirection in class DBStatementi - iSQLException - java.sql.SQLExceptionpublic boolean getMoreResults()
throws SQLException
DBStatementThere are no more results when the following is true:
// stmt is a Statement object ((stmt.getMoreResults() == false) &&
(stmt.getUpdateCount() == -1))
Support DBvolution at Patreon
getMoreResults in interface StatementgetMoreResults in class DBStatementSQLException - java.sql.SQLExceptionpublic int getUpdateCount()
throws SQLException
DBStatementThis method should be called only once per result.
Support DBvolution at Patreon
getUpdateCount in interface StatementgetUpdateCount in class DBStatementResultSet object or there are no more results. 1 Database
exceptions may be thrownSQLException - java.sql.SQLExceptionpublic ResultSet getResultSet() throws SQLException
DBStatementThis method should be called only once per result.
Support DBvolution at Patreon
getResultSet in interface StatementgetResultSet in class DBStatementResultSet object or
null if the result is an update count or there are no more
results 1 Database exceptions may be thrownSQLException - java.sql.SQLExceptionpublic boolean execute(String sql) throws SQLException
DBStatementIn some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
execute in interface Statementexecute in class DBStatementsql - string
Support DBvolution at Patreon
TRUE if the first result is a ResultSet
object; FALSE if it is an update count or there are no results
1 Database exceptions may be thrownSQLException - java.sql.SQLExceptionpublic void setCursorName(String string) throws SQLException
DBStatementThis name can then be used in SQL positioned update or delete statements to identify the current row in the ResultSet object generated by this statement. If the database does not support positioned update/delete, this method is a noop. To insure that a cursor has the proper isolation level to support updates, the cursor's SELECT statement should have the form SELECT FOR UPDATE. If FOR UPDATE is not present, positioned updates may fail. 1 Database exceptions may be thrown
setCursorName in interface StatementsetCursorName in class DBStatementstring - stringSQLException - java.sql.SQLExceptionpublic void clearWarnings()
throws SQLException
DBStatementclearWarnings in interface StatementclearWarnings in class DBStatementSQLException - java.sql.SQLExceptionpublic SQLWarning getWarnings() throws SQLException
DBStatementThe warning chain is automatically cleared each time a statement is (re)executed. This method may not be called on a closed Statement object; doing so will cause an SQLException to be thrown.
Support DBvolution at Patreon
getWarnings in interface StatementgetWarnings in class DBStatementSQLWarning object or null if
there are no warnings 1 Database exceptions may be thrownSQLException - java.sql.SQLExceptionprotected void replaceBrokenConnection()
throws SQLException,
UnableToCreateDatabaseConnectionException,
UnableToFindJDBCDriver
DBStatement
Call this after canceling or closing a statement for a database that close
the connection with the statement. Use DBDefinition.willCloseConnectionOnStatementCancel() to detect this situation.
replaceBrokenConnection in class DBStatementSQLException - exceptions from connecting to the database and
creating a Statement.UnableToCreateDatabaseConnectionException - may be thrown if there is
an issue with connecting.UnableToFindJDBCDriver - may be thrown if the JDBCDriver is not on
the class path. DBvolution includes several JDBCDrivers already but Oracle
and MS SQLserver, in particular, need to be added to the path if you wish
to work with those databases.public void cancel()
throws SQLException
DBStatementcancel in interface Statementcancel in class DBStatementSQLExceptionpublic void setQueryTimeout(int i)
throws SQLException
DBStatementsetQueryTimeout in interface StatementsetQueryTimeout in class DBStatementi - iSQLException - java.sql.SQLExceptionpublic int getQueryTimeout()
throws SQLException
DBStatementSupport DBvolution at Patreon
getQueryTimeout in interface StatementgetQueryTimeout in class DBStatementSQLException - java.sql.SQLExceptionpublic void setEscapeProcessing(boolean bln)
throws SQLException
DBStatementsetEscapeProcessing in interface StatementsetEscapeProcessing in class DBStatementbln - blnSQLException - java.sql.SQLExceptionpublic void setMaxRows(int i)
throws SQLException
DBStatementsetMaxRows in interface StatementsetMaxRows in class DBStatementi - iSQLException - java.sql.SQLExceptionpublic int getMaxRows()
throws SQLException
DBStatementSupport DBvolution at Patreon
getMaxRows in interface StatementgetMaxRows in class DBStatementResultSet
object produced by this Statement object; zero means there is
no limit 1 Database exceptions may be thrownSQLException - java.sql.SQLExceptionpublic void setMaxFieldSize(int i)
throws SQLException
DBStatementsetMaxFieldSize in interface StatementsetMaxFieldSize in class DBStatementi - iSQLException - java.sql.SQLExceptionpublic int getMaxFieldSize()
throws SQLException
DBStatementSupport DBvolution at Patreon
getMaxFieldSize in interface StatementgetMaxFieldSize in class DBStatementSQLException - java.sql.SQLExceptionpublic void close()
throws SQLException
DBStatementAlso informs the DBDatabase that there is one less connection to the database. 1 Database exceptions may be thrown
close in interface AutoCloseableclose in interface Statementclose in class DBStatementSQLException - java.sql.SQLExceptionpublic int executeUpdate(String string) throws SQLException
DBStatementexecuteUpdate in interface StatementexecuteUpdate in class DBStatementstring - string
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic ResultSet executeQuery(String string) throws SQLException
DBStatementexecuteQuery in interface StatementexecuteQuery in class DBStatementstring - SQL
Support DBvolution at Patreon
SQLException - database exceptionsCopyright © 2018. All Rights Reserved.