public abstract class Statement extends Object implements Statement, StatementCallbackInterface
| Modifier and Type | Field and Description |
|---|---|
int |
autoGeneratedKeys_ |
Cursor |
cachedCursor_ |
Cursor |
cachedSingletonRowData_ |
static int |
CLOSE_ALL_RESULTS |
static int |
CLOSE_CURRENT_RESULT |
String |
cursorAttributesToSendOnPrepare_ |
protected boolean |
doWriteTimeout |
int |
fetchDirection_ |
int |
fetchSize_ |
int[] |
generatedKeysColumnIndexes_ |
String[] |
generatedKeysColumnNames_ |
ResultSet |
generatedKeysResultSet_ |
protected int |
indexOfCurrentResultSet_ |
static int |
isCommitSql__ |
protected boolean |
isPoolable |
boolean |
isPreparedStatement_ |
static int |
isQuery__ |
static int |
isRollbackSql__ |
static int |
KEEP_CURRENT_RESULT |
MaterialStatement |
materialStatement_ |
int |
numInvisibleRS_ |
PreparedStatement |
preparedStatementForAutoGeneratedKeys_ |
int |
resultSetConcurrency_ |
int |
resultSetHoldability_ |
int |
resultSetType_ |
Section |
section_ |
protected static String |
SET_SCHEMA_STATEMENT |
Cursor |
singletonRowData_ |
protected ArrayList |
specialRegisterArrayList |
int |
sqlMode_ |
protected String |
statementUUID |
protected static String |
TIMEOUT_STATEMENT |
EXECUTE_FAILED, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Constructor and Description |
|---|
Statement(Agent agent,
Connection connection) |
Statement(Agent agent,
Connection connection,
int type,
int concurrency,
int holdability,
int autoGeneratedKeys,
String[] columnNames,
int[] columnIndexes) |
| Modifier and Type | Method and Description |
|---|---|
void |
accumulateWarning(SqlWarning e) |
void |
addBatch(String sql) |
void |
cancel() |
protected void |
checkForDuplicateCursorName() |
protected void |
checkForStoredProcResultSetCount(int executeType)
Checks that a stored procedure returns the correct number of
result sets given its execute type.
|
protected void |
cleanSingleHopPrepStmnt() |
void |
clearBatch() |
void |
clearWarnings() |
void |
close() |
void |
closeX()
An untraced version of
close. |
void |
completeExecute(Sqlca sqlca) |
void |
completeExecuteCall(Sqlca sqlca,
Cursor singletonParams) |
void |
completeExecuteCall(Sqlca sqlca,
Cursor singletonParams,
ResultSet[] resultSets) |
void |
completeExecuteCallOpenQuery(Sqlca sqlca,
ResultSet resultSet,
ColumnMetaData resultSetMetaData,
Section generatedSection) |
void |
completeExecuteImmediate(Sqlca sqlca) |
void |
completeExecuteSetStatement(Sqlca sqlca) |
void |
completeLocalCommit(Iterator listenerIterator) |
void |
completeLocalRollback(Iterator listenerIterator) |
void |
completeOpenQuery(Sqlca sqlca,
ResultSet resultSet) |
void |
completePrepare(Sqlca sqlca) |
void |
completePrepareDescribeOutput(ColumnMetaData resultSetMetaData,
Sqlca sqlca) |
int |
completeSqlca(Sqlca sqlca) |
void |
completeStatementIDRead(String statementUUID) |
boolean |
execute(String sql) |
boolean |
execute(String sql,
int autoGeneratedKeys) |
boolean |
execute(String sql,
int[] columnIndexes) |
boolean |
execute(String sql,
String[] columnNames) |
int[] |
executeBatch() |
ResultSet |
executeQuery(String sql) |
int |
executeUpdate(String sql) |
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
int |
executeUpdate(String sql,
int[] columnIndexes) |
int |
executeUpdate(String sql,
String[] columnNames) |
protected void |
finalize() |
Connection |
getConnection() |
ConnectionCallbackInterface |
getConnectionCallbackInterface() |
int |
getFetchDirection() |
int |
getFetchSize() |
ResultSet |
getGeneratedKeys() |
ColumnMetaData |
getGuessedResultSetMetaData() |
protected String |
getJdbcStatementInterfaceName()
Returns the name of the java.sql interface implemented by this class.
|
int |
getMaxFieldSize() |
int |
getMaxRows() |
boolean |
getMoreResults() |
boolean |
getMoreResults(int current) |
int |
getQueryTimeout() |
ResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
Section |
getSection() |
protected SqlWarning |
getSqlWarnings() |
int |
getUpdateCount() |
SQLWarning |
getWarnings() |
protected void |
initResetPreparedStatement(boolean completeReset) |
boolean |
isCallMode() |
boolean |
isClosed()
Tell whether the statement has been closed or not.
|
boolean |
isClosedNoThrow() |
boolean |
isPoolable()
Returns the value of the poolable hint, indicating whether
pooling is requested.
|
boolean |
isQueryMode() |
boolean |
isWrapperFor(Class iface)
Returns false unless
iface is implemented |
protected SQLException |
jdbc3FeatureNotSupported() |
protected SQLException |
jdbc3FeatureNotSupported(boolean checkStatement) |
void |
listenToUnitOfWork() |
void |
markAutoCommitted()
Mark all ResultSets associated with this statement as auto-committed.
|
boolean |
needStatementUUID() |
void |
readExecuteCall() |
void |
readExecuteImmediate() |
void |
readExecuteImmediateForBatch(String sql) |
void |
readOpenQuery() |
void |
readPrepare() |
void |
readPrepareDescribeOutput() |
void |
readSetSpecialRegister() |
void |
readStatementID() |
protected void |
removeClientCursorNameFromCache() |
void |
reset(boolean fullReset) |
void |
resetStatement(Agent agent,
Connection connection) |
void |
resetStatement(Agent agent,
Connection connection,
int type,
int concurrency,
int holdability,
int autoGeneratedKeys,
String[] columnNames,
int[] columnIndexes) |
void |
resultSetCommitting(ResultSet closingRS)
Convenience method for resultSetCommitting(ResultSet, boolean)
|
boolean |
resultSetCommitting(ResultSet closingRS,
boolean writeChain)
Method that checks to see if any other ResultSets are open.
|
protected int[] |
setAndStoreClientParamType(int[] clientParamtype) |
void |
setCursorName(String name) |
void |
setEscapeProcessing(boolean enable) |
void |
setFetchDirection(int direction) |
void |
setFetchSize(int rows) |
void |
setMaxFieldSize(int max) |
void |
setMaxRows(int maxRows) |
protected void |
setOwner(Statement owner)
Designates the owner of this statement, typically a logical statement.
|
void |
setPoolable(boolean poolable)
Requests that a Statement be pooled or not.
|
void |
setQueryTimeout(int seconds) |
protected void |
setupCursorNameCacheAndMappings() |
void |
setUpdateCount(int updateCount) |
protected String |
substituteClientCursorNameWithServerCursorName(String sql,
Section section) |
static String |
upperCaseProcedureName(String procedureName) |
void |
writeExecuteCall(boolean outputExpected,
String procedureName,
Section section,
int fetchSize,
boolean suppressResultSets,
int resultSetType,
ColumnMetaData parameterMetaData,
Object[] inputs) |
void |
writeExecuteImmediate(String sql,
Section section) |
void |
writeGetStmtUUID(Section section) |
void |
writeOpenQuery(Section section,
int fetchSize,
int resultSetType) |
void |
writePrepare(String sql,
Section section) |
void |
writePrepareDescribeOutput(String sql,
Section section,
boolean needStatementUUID) |
void |
writeSetSpecialRegister(ArrayList sqlsttList) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseOnCompletion, isCloseOnCompletionpublic static final int CLOSE_CURRENT_RESULT
public static final int KEEP_CURRENT_RESULT
public static final int CLOSE_ALL_RESULTS
public MaterialStatement materialStatement_
public Section section_
public int sqlMode_
public static final int isQuery__
public static final int isCommitSql__
public static final int isRollbackSql__
public Cursor cachedCursor_
public Cursor cachedSingletonRowData_
protected static final String SET_SCHEMA_STATEMENT
public boolean isPreparedStatement_
protected int indexOfCurrentResultSet_
protected static final String TIMEOUT_STATEMENT
protected final ArrayList specialRegisterArrayList
protected boolean doWriteTimeout
public int resultSetType_
public int resultSetConcurrency_
public int resultSetHoldability_
public int fetchSize_
public int fetchDirection_
public Cursor singletonRowData_
public int numInvisibleRS_
public String cursorAttributesToSendOnPrepare_
public PreparedStatement preparedStatementForAutoGeneratedKeys_
public ResultSet generatedKeysResultSet_
public String[] generatedKeysColumnNames_
public int[] generatedKeysColumnIndexes_
public int autoGeneratedKeys_
protected boolean isPoolable
protected String statementUUID
public Statement(Agent agent, Connection connection) throws SqlException
SqlExceptionpublic Statement(Agent agent, Connection connection, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException
SqlExceptionprotected void initResetPreparedStatement(boolean completeReset)
public void reset(boolean fullReset)
throws SqlException
SqlExceptionpublic void resetStatement(Agent agent, Connection connection) throws SqlException
SqlExceptionpublic void resetStatement(Agent agent, Connection connection, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException
SqlExceptionprotected void finalize()
throws Throwable
protected SqlWarning getSqlWarnings()
public ResultSet executeQuery(String sql) throws SQLException
executeQuery in interface StatementSQLExceptionpublic int executeUpdate(String sql) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic boolean isWrapperFor(Class iface) throws SQLException
iface is implementedisWrapperFor in interface Wrapperiface - a Class defining an interface.SQLException - if an error occurs while determining
whether this is a wrapper for an object
with the given interface.public boolean isClosed()
throws SQLException
isClosed in interface Statementtrue if closed, false otherwise.SQLException - if a database access error occurs (according to
spec). Never thrown by this implementation.public boolean isClosedNoThrow()
public void close()
throws SQLException
close in interface AutoCloseableclose in interface StatementSQLExceptionpublic void closeX()
throws SqlException
close. This method cleans up
client-side resources and also sends commands to network server to
perform clean up. This should not be called in the finalizer.
Difference between finalize and close is
that close method does these things additionally (Changes done as
part of DERBY-210):
1) Sends commands to the server to close the result sets.
2) Sends commands to the server to close the result sets of the
generated keys query.
3) Sends a commit if autocommit is on and it is appropriate.
4) Explicitly removes the statement from connection_.openStatements_
and CommitAndRollbackListeners_ by passing true to markClosed.
We may need to do 1) in finalizer too. This is being tracked in
DERBY-1021SqlExceptionprotected void cleanSingleHopPrepStmnt()
throws SqlException
SqlExceptionprotected int[] setAndStoreClientParamType(int[] clientParamtype)
public boolean isPoolable()
throws SQLException
isPoolable in interface StatementSQLException - if the Statement has been closed.public void setPoolable(boolean poolable)
throws SQLException
setPoolable in interface Statementpoolable - requests that the Statement be pooled if true
and not be pooled if false.SQLException - if the Statement has been closed.public int getMaxFieldSize()
throws SQLException
getMaxFieldSize in interface StatementSQLExceptionpublic void setMaxFieldSize(int max)
throws SQLException
setMaxFieldSize in interface StatementSQLExceptionpublic int getMaxRows()
throws SQLException
getMaxRows in interface StatementSQLExceptionpublic void setMaxRows(int maxRows)
throws SQLException
setMaxRows in interface StatementSQLExceptionpublic void setEscapeProcessing(boolean enable)
throws SQLException
setEscapeProcessing in interface StatementSQLExceptionpublic int getQueryTimeout()
throws SQLException
getQueryTimeout in interface StatementSQLExceptionpublic void setQueryTimeout(int seconds)
throws SQLException
setQueryTimeout in interface StatementSQLExceptionpublic void cancel()
throws SQLException
cancel in interface StatementSQLExceptionpublic SQLWarning getWarnings() throws SQLException
getWarnings in interface StatementSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings in interface StatementSQLExceptionpublic void setCursorName(String name) throws SQLException
setCursorName in interface StatementSQLExceptionpublic boolean execute(String sql) throws SQLException
execute in interface StatementSQLExceptionpublic ResultSet getResultSet() throws SQLException
getResultSet in interface StatementSQLExceptionpublic int getUpdateCount()
throws SQLException
getUpdateCount in interface StatementSQLExceptionpublic boolean getMoreResults()
throws SQLException
getMoreResults in interface StatementSQLExceptionpublic void setFetchDirection(int direction)
throws SQLException
setFetchDirection in interface StatementSQLExceptionpublic int getFetchDirection()
throws SQLException
getFetchDirection in interface StatementSQLExceptionpublic void setFetchSize(int rows)
throws SQLException
setFetchSize in interface StatementSQLExceptionpublic int getFetchSize()
throws SQLException
getFetchSize in interface StatementSQLExceptionpublic int getResultSetConcurrency()
throws SQLException
getResultSetConcurrency in interface StatementSQLExceptionpublic int getResultSetType()
throws SQLException
getResultSetType in interface StatementSQLExceptionpublic void addBatch(String sql) throws SQLException
addBatch in interface StatementSQLExceptionpublic void clearBatch()
throws SQLException
clearBatch in interface StatementSQLExceptionpublic int[] executeBatch()
throws SQLException,
BatchUpdateException
executeBatch in interface StatementSQLExceptionBatchUpdateExceptionpublic Connection getConnection() throws SQLException
getConnection in interface StatementSQLExceptionpublic boolean getMoreResults(int current)
throws SQLException
getMoreResults in interface StatementSQLExceptionpublic ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys in interface StatementSQLExceptionpublic int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute in interface StatementSQLExceptionpublic boolean execute(String sql, int[] columnIndexes) throws SQLException
execute in interface StatementSQLExceptionpublic boolean execute(String sql, String[] columnNames) throws SQLException
execute in interface StatementSQLExceptionpublic int getResultSetHoldability()
throws SQLException
getResultSetHoldability in interface StatementSQLExceptionpublic void writeSetSpecialRegister(ArrayList sqlsttList) throws SqlException
SqlExceptionpublic void readSetSpecialRegister()
throws SqlException
SqlExceptionpublic void writeExecuteImmediate(String sql, Section section) throws SqlException
SqlExceptionpublic void readExecuteImmediate()
throws SqlException
SqlExceptionpublic void completeExecuteImmediate(Sqlca sqlca)
completeExecuteImmediate in interface StatementCallbackInterfacepublic void readExecuteImmediateForBatch(String sql) throws SqlException
SqlExceptionpublic void writePrepareDescribeOutput(String sql, Section section, boolean needStatementUUID) throws SqlException
SqlExceptionpublic void readPrepareDescribeOutput()
throws SqlException
SqlExceptionpublic void writeGetStmtUUID(Section section) throws SqlException
SqlExceptionpublic void readStatementID()
throws SqlException
SqlExceptionpublic void completePrepareDescribeOutput(ColumnMetaData resultSetMetaData, Sqlca sqlca)
completePrepareDescribeOutput in interface StatementCallbackInterfacepublic void writePrepare(String sql, Section section) throws SqlException
SqlExceptionpublic void readPrepare()
throws SqlException
SqlExceptionpublic void completePrepare(Sqlca sqlca)
completePrepare in interface StatementCallbackInterfacepublic void writeOpenQuery(Section section, int fetchSize, int resultSetType) throws SqlException
SqlExceptionpublic void readOpenQuery()
throws SqlException
SqlExceptionpublic void completeOpenQuery(Sqlca sqlca, ResultSet resultSet)
completeOpenQuery in interface StatementCallbackInterfacepublic void completeExecuteCallOpenQuery(Sqlca sqlca, ResultSet resultSet, ColumnMetaData resultSetMetaData, Section generatedSection)
completeExecuteCallOpenQuery in interface StatementCallbackInterfacepublic void writeExecuteCall(boolean outputExpected,
String procedureName,
Section section,
int fetchSize,
boolean suppressResultSets,
int resultSetType,
ColumnMetaData parameterMetaData,
Object[] inputs)
throws SqlException
SqlExceptionpublic void readExecuteCall()
throws SqlException
SqlExceptionpublic void completeExecuteCall(Sqlca sqlca, Cursor singletonParams, ResultSet[] resultSets)
completeExecuteCall in interface StatementCallbackInterfacepublic void completeExecuteCall(Sqlca sqlca, Cursor singletonParams)
completeExecuteCall in interface StatementCallbackInterfacepublic void completeExecute(Sqlca sqlca)
completeExecute in interface StatementCallbackInterfacepublic void setUpdateCount(int updateCount)
protected final void setOwner(Statement owner)
owner - the owning statement, if anypublic int completeSqlca(Sqlca sqlca)
completeSqlca in interface StatementCallbackInterfacepublic void completeExecuteSetStatement(Sqlca sqlca)
completeExecuteSetStatement in interface StatementCallbackInterfacepublic void listenToUnitOfWork()
listenToUnitOfWork in interface UnitOfWorkListenerpublic void completeLocalCommit(Iterator listenerIterator)
completeLocalCommit in interface UnitOfWorkListenerpublic void completeLocalRollback(Iterator listenerIterator)
completeLocalRollback in interface UnitOfWorkListenerpublic void accumulateWarning(SqlWarning e)
accumulateWarning in interface StatementCallbackInterfaceprotected String getJdbcStatementInterfaceName()
public static String upperCaseProcedureName(String procedureName) throws SqlException
SqlExceptionprotected final void checkForStoredProcResultSetCount(int executeType)
throws SqlException
executeType - one of executeQueryMethod__,
executeUpdateMethod__ and executeMethod__SqlException - if the number of result sets does not
match the execute typecheckResultSetCount(int)protected void checkForDuplicateCursorName()
throws SqlException
SqlExceptionprotected void setupCursorNameCacheAndMappings()
protected String substituteClientCursorNameWithServerCursorName(String sql, Section section) throws SqlException
SqlExceptionpublic ConnectionCallbackInterface getConnectionCallbackInterface()
getConnectionCallbackInterface in interface StatementCallbackInterfacepublic ColumnMetaData getGuessedResultSetMetaData()
getGuessedResultSetMetaData in interface StatementCallbackInterfacepublic boolean isQueryMode()
public boolean needStatementUUID()
protected void removeClientCursorNameFromCache()
public void resultSetCommitting(ResultSet closingRS) throws SqlException
closingRS - The ResultSet to be closedSqlExceptionresultSetCommitting(ResultSet, boolean)public boolean resultSetCommitting(ResultSet closingRS, boolean writeChain) throws SqlException
closingRS - The ResultSet to be closedwriteChain - A Boolean indicating whether this method
is part of a chain of write from client to ServerSqlExceptionpublic void markAutoCommitted()
protected SQLException jdbc3FeatureNotSupported(boolean checkStatement) throws SQLException
SQLExceptionprotected SQLException jdbc3FeatureNotSupported() throws SQLException
SQLExceptionpublic boolean isCallMode()
public Section getSection()
getSection in interface StatementCallbackInterfacepublic void completeStatementIDRead(String statementUUID)
completeStatementIDRead in interface StatementCallbackInterfaceCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.