Class ClientStatement
java.lang.Object
org.apache.derby.client.am.ClientStatement
- All Implemented Interfaces:
AutoCloseable, Statement, Wrapper, StatementCallbackInterface, UnitOfWorkListener
- Direct Known Subclasses:
ClientPreparedStatement
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Agent(package private) intprivate booleanprivate boolean(package private) ClientConnection(package private) Stringprotected boolean(package private) static final int(package private) static final int(package private) static final int(package private) intprivate static longFor use in debugging setLargeMaxRows() method added by JDBC 4.2(package private) int(package private) int[](package private) String[](package private) ClientResultSetprivate intprivate static final intprivate static final int(package private) boolean(package private) static final int(package private) boolean(package private) static final int(package private) static final intprotected boolean(package private) boolean(package private) static final int(package private) static final int(package private) static final intprivate MaterialStatement(package private) int(package private) long(package private) booleanprivate static final intState constants used by the FSM inside getStatementToken.private StatementThe owner of this statement, if any.(package private) ClientPreparedStatement(package private) ClientResultSetint(package private) int(package private) ClientResultSet[](package private) ColumnMetaDataintprivate Sectionprivate SectionThis variable keeps track of a Section dediacted to writeSpecialRegister.(package private) Cursorprotected int(package private) int(package private) intprotected static final String(package private) longprivate SqlWarningFields inherited from interface Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateClientStatement(Agent agent, ClientConnection connection) ClientStatement(Agent agent, ClientConnection connection, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoid(package private) Stringvoidcancel()(package private) void(package private) final voidcheckForAppropriateSqlMode(int executeType, int sqlMode) (package private) final voidprotected voidprivate voidprotected final voidcheckForStoredProcResultSetCount(int executeType) Checks that a stored procedure returns the correct number of result sets given its execute type.private voidcheckResultSetCount(int executeType) Checks that the number of result sets returned by the statement is consistent with the executed type.voidvoid(package private) final voidvoidclose()private voidcloseEverythingExceptResultSets(boolean removeListener) Close all resources except for ResultSets.(package private) voidvoid/////////////////////////////////////////////////////////////////(package private) voidcloseX()An untraced version ofclose.voidcompleteExecute(Sqlca sqlca) voidcompleteExecuteCall(Sqlca sqlca, Cursor singletonParams) voidcompleteExecuteCall(Sqlca sqlca, Cursor singletonParams, ClientResultSet[] resultSets) voidcompleteExecuteCallOpenQuery(Sqlca sqlca, ClientResultSet resultSet, ColumnMetaData resultSetMetaData, Section generatedSection) voidcompleteExecuteImmediate(Sqlca sqlca) voidcompleteExecuteSetStatement(Sqlca sqlca) voidcompleteLocalCommit(Iterator listenerIterator) voidcompleteLocalRollback(Iterator listenerIterator) voidcompleteOpenQuery(Sqlca sqlca, ClientResultSet resultSet) voidcompletePrepare(Sqlca sqlca) voidcompletePrepareDescribeOutput(ColumnMetaData resultSetMetaData, Sqlca sqlca) intcompleteSqlca(Sqlca sqlca) (package private) Stringbooleanbooleanbooleanbooleanint[]private long[]long[]longexecuteLargeUpdate(String sql) longexecuteLargeUpdate(String sql, int autoGeneratedKeys) longexecuteLargeUpdate(String sql, int[] columnIndexes) longexecuteLargeUpdate(String sql, String[] columnNames) executeQuery(String sql) private ClientResultSetexecuteQueryX(String sql) intexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndexes) intexecuteUpdate(String sql, String[] columnNames) private longexecuteUpdateX(String sql) (package private) boolean(package private) String[]protected voidfinalize()private voidprivate voidprivate voidprivate voidprivate voidflowExecute(int executeType, String sql) private voidflowExecuteBatch(long[] updateCounts) intintprotected StringReturns the name of the java.sql interface implemented by this class.longlongintintbooleanbooleangetMoreResults(int current) private booleangetMoreResultsX(int current) (package private) final StatementgetOwner()Returns the owner of this statement, if any.intintintintProvides public access for section_.protected SqlWarningprivate StringgetStatementToken(String sql) Step past any initial non-significant characters and comments to find first significant SQL token so we can classify statement.intprotected voidprivate voidprivate voidprivate voidinitStatement(int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) private voidinitStatement(Agent agent, ClientConnection connection) booleanisClosed()Tell whether the statement has been closed or not.booleanprivate StringMinion of getStatementToken.private booleanbooleanReturns the value of the poolable hint, indicating whether pooling is requested.booleanbooleanisWrapperFor(Class<?> iface) Returns false unlessifaceis implementedvoidprivate voidprivate voidMark all ResultSets associated with this statement as auto-committed.(package private) voidThis method cleans up client-side resources held by this Statement.(package private) voidmarkClosed(boolean removeListener) This method cleans up client-side resources held by this Statement.private voidprivate void(package private) final voidmarkResultSetsClosed(boolean removeListener) Mark all ResultSets associated with this statement as closed.(package private) void(package private) voidprivate voidparseUpdateSql(String firstToken) protected static ClientPreparedStatement(package private) final voidreadClose(boolean allowAutoCommits) (package private) final voidreadCloseResultSets(boolean allowAutoCommits) private voidreadCloseResultSets(int number, boolean allowAutoCommits) (package private) voidprivate voidprivate void(package private) void(package private) void(package private) void(package private) voidprotected voidvoidreset(boolean fullReset) (package private) void(package private) voidResets the statement for reuse in a statement pool.(package private) voidprivate void(package private) voidresetStatement(Agent agent, ClientConnection connection) voidresetStatement(Agent agent, ClientConnection connection, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) private voidResets attributes that can be modified by the user through theStatementinterface to default values.(package private) voidresultSetCommitting(ClientResultSet closingRS) Convenience method for resultSetCommitting(ClientResultSet, boolean)(package private) booleanresultSetCommitting(ClientResultSet closingRS, boolean writeChain) Method that checks to see if any other ResultSets are open.voidsetCursorName(String name) voidsetEscapeProcessing(boolean enable) voidsetFetchDirection(int direction) static voidsetFetchedRowBase(long newBase) Debug method used to test the setLargeMaxRows() method added by JDBC 4.2.voidsetFetchSize(int rows) voidsetLargeMaxRows(long maxRows) voidsetMaterialStatement(MaterialStatement materialStatement) voidsetMaxFieldSize(int max) voidsetMaxRows(int maxRows) protected final voidDesignates the owner of this statement, typically a logical statement.voidsetPoolable(boolean poolable) Requests that a Statement be pooled or not.voidsetQueryTimeout(int seconds) protected voidAssigns a new value (even null) to section_.protected voidvoidsetUpdateCount(long updateCount) protected StringsubstituteClientCursorNameWithServerCursorName(String sql, Section section) <T> TReturnsthisif this class implements the specified interface.private booleanwillTickleServer(int number, boolean allowAutoCommits) (package private) final voidwriteClose(boolean allowAutoCommits) (package private) final booleanwriteCloseResultSets(boolean allowAutoCommits) The connection close processing passes allowAutoCommits=false because if we drove an auto-commits after each statement close, then when we issue close requests on non-held cursors the server would complain that the non-held cursor was already closed from the previous statement's auto-commit.private booleanwriteCloseResultSets(int number, boolean allowAutoCommits) (package private) voidwriteExecuteCall(boolean outputExpected, String procedureName, Section section, int fetchSize, boolean suppressResultSets, int resultSetType, ColumnMetaData parameterMetaData, Object[] inputs) private SectionwriteExecuteCall(String sql, boolean isBatch) private voidwriteExecuteImmediate(String sql, Section section) (package private) voidwriteOpenQuery(Section section, int fetchSize, int resultSetType) (package private) voidwritePrepare(String sql, Section section) (package private) voidwritePrepareDescribeOutput(String sql, Section section) (package private) voidwriteSetSpecialRegister(ArrayList sqlsttList) Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isSimpleIdentifier
-
Field Details
-
fetchedRowBase
private static long fetchedRowBaseFor use in debugging setLargeMaxRows() method added by JDBC 4.2 -
materialStatement_
-
connection_
ClientConnection connection_ -
section_
-
agent_
Agent agent_ -
owner
The owner of this statement, if any. -
resultSet_
ClientResultSet resultSet_ -
updateCount_
long updateCount_ -
executeQueryMethod__
static final int executeQueryMethod__- See Also:
-
executeUpdateMethod__
static final int executeUpdateMethod__- See Also:
-
executeMethod__
static final int executeMethod__- See Also:
-
sqlMode_
protected int sqlMode_ -
isQuery__
static final int isQuery__- See Also:
-
isCall__
static final int isCall__- See Also:
-
isUpdate__
static final int isUpdate__- See Also:
-
sqlUpdateMode_
int sqlUpdateMode_ -
isInsertSql__
static final int isInsertSql__- See Also:
-
isDeleteSql__
static final int isDeleteSql__- See Also:
-
isUpdateSql__
static final int isUpdateSql__- See Also:
-
resultSetMetaData_
ColumnMetaData resultSetMetaData_ -
cachedCursor_
-
cachedSingletonRowData_
-
isPreparedStatement_
boolean isPreparedStatement_ -
cursorName_
String cursorName_ -
openOnClient_
boolean openOnClient_ -
indexOfCurrentResultSet_
private int indexOfCurrentResultSet_ -
resultSetList_
ClientResultSet[] resultSetList_ -
TIMEOUT_STATEMENT
- See Also:
-
timeoutArrayList
-
doWriteTimeout
protected boolean doWriteTimeout -
timeout_
int timeout_ -
maxRows_
long maxRows_ -
maxFieldSize_
int maxFieldSize_ -
isAutoCommittableStatement_
boolean isAutoCommittableStatement_ -
isCatalogQuery_
boolean isCatalogQuery_ -
batch_
-
resultSetType_
public int resultSetType_ -
resultSetConcurrency_
public int resultSetConcurrency_ -
resultSetHoldability_
int resultSetHoldability_ -
fetchSize_
int fetchSize_ -
fetchDirection_
int fetchDirection_ -
singletonRowData_
Cursor singletonRowData_ -
cursorAttributesToSendOnPrepare_
-
preparedStatementForAutoGeneratedKeys_
ClientPreparedStatement preparedStatementForAutoGeneratedKeys_ -
generatedKeysResultSet_
ClientResultSet generatedKeysResultSet_ -
generatedKeysColumnNames_
String[] generatedKeysColumnNames_ -
generatedKeysColumnIndexes_
int[] generatedKeysColumnIndexes_ -
autoGeneratedKeys_
int autoGeneratedKeys_ -
warnings_
-
isPoolable
protected boolean isPoolable -
closeOnCompletion_
private boolean closeOnCompletion_ -
closingResultSets_
private boolean closingResultSets_ -
setSpecialRegisterSection_
This variable keeps track of a Section dediacted to writeSpecialRegister. It gets initialized the first time a Section is needed, and freed when the Statement is closed. -
OUTSIDE
private static final int OUTSIDEState constants used by the FSM inside getStatementToken.- See Also:
-
INSIDE_SIMPLECOMMENT
private static final int INSIDE_SIMPLECOMMENT- See Also:
-
INSIDE_BRACKETED_COMMENT
private static final int INSIDE_BRACKETED_COMMENT- See Also:
-
-
Constructor Details
-
ClientStatement
private ClientStatement() -
ClientStatement
- Throws:
SqlException
-
ClientStatement
public ClientStatement(Agent agent, ClientConnection connection, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Throws:
SqlException
-
-
Method Details
-
setFetchedRowBase
public static void setFetchedRowBase(long newBase) Debug method used to test the setLargeMaxRows() method added by JDBC 4.2. This method is a NOP on a production (insane) build of Derby. -
getMaterialStatement
- Returns:
- the materialStatement
-
setMaterialStatement
- Parameters:
materialStatement- the materialStatement to set
-
resetStatement
private void resetStatement() -
initStatement
private void initStatement() -
initResetStatement
private void initResetStatement() -
initResetPreparedStatement
protected void initResetPreparedStatement() -
resetUserControllableAttributes
private void resetUserControllableAttributes()Resets attributes that can be modified by the user through theStatementinterface to default values. -
reset
- Throws:
SqlException
-
resetForReuse
Resets the statement for reuse in a statement pool.Intended to be used only by prepared or callable statements, as
Statementobjects aren't pooled.The following actions are taken:
- Batches are cleared.
- Warnings are cleared.
- Open result set are closed on the client and the server.
- Cached cursor names are cleared.
- Statement for fetching auto-generated keys is closed.
- Special registers are reset.
- User controllable attributes are reset to defaults, for instance query timeout and max rows to fetch.
- Throws:
SqlException- if resetting the statement fails
-
resetStatement
- Throws:
SqlException
-
initStatement
-
resetStatement
public void resetStatement(Agent agent, ClientConnection connection, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Throws:
SqlException
-
initStatement
private void initStatement(int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Throws:
SqlException
-
finalize
-
getSqlWarnings
-
executeQuery
- Specified by:
executeQueryin interfaceStatement- Throws:
SQLException
-
executeQueryX
- Throws:
SqlException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdateX
- Throws:
SqlException
-
isWrapperFor
Returns false unlessifaceis implemented- Specified by:
isWrapperForin interfaceWrapper- Parameters:
iface- a Class defining an interface.- Returns:
- true if this implements the interface or directly or indirectly wraps an object that does.
- Throws:
SQLException- if an error occurs while determining whether this is a wrapper for an object with the given interface.
-
unwrap
Returnsthisif this class implements the specified interface.- Specified by:
unwrapin interfaceWrapper- Parameters:
iface- a class defining an interface- Returns:
- an object that implements the interface
- Throws:
SQLException- if no object is found that implements the interface
-
isClosed
Tell whether the statement has been closed or not.- Specified by:
isClosedin interfaceStatement- Returns:
trueif closed,falseotherwise.- Throws:
SQLException- if a database access error occurs (according to spec). Never thrown by this implementation.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Throws:
SQLException
-
closeX
An untraced version ofclose. 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 betweenfinalizeandcloseis 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-1021- Throws:
SqlException
-
isPoolable
Returns the value of the poolable hint, indicating whether pooling is requested.- Specified by:
isPoolablein interfaceStatement- Returns:
- The value of the poolable hint.
- Throws:
SQLException- if the Statement has been closed.
-
setPoolable
Requests that a Statement be pooled or not.- Specified by:
setPoolablein interfaceStatement- Parameters:
poolable- requests that the Statement be pooled if true and not be pooled if false.- Throws:
SQLException- if the Statement has been closed.
-
getMaxFieldSize
- Specified by:
getMaxFieldSizein interfaceStatement- Throws:
SQLException
-
setMaxFieldSize
- Specified by:
setMaxFieldSizein interfaceStatement- Throws:
SQLException
-
getMaxRows
- Specified by:
getMaxRowsin interfaceStatement- Throws:
SQLException
-
getLargeMaxRows
- Specified by:
getLargeMaxRowsin interfaceStatement- Throws:
SQLException
-
setMaxRows
- Specified by:
setMaxRowsin interfaceStatement- Throws:
SQLException
-
setLargeMaxRows
- Specified by:
setLargeMaxRowsin interfaceStatement- Throws:
SQLException
-
setEscapeProcessing
- Specified by:
setEscapeProcessingin interfaceStatement- Throws:
SQLException
-
getQueryTimeout
- Specified by:
getQueryTimeoutin interfaceStatement- Throws:
SQLException
-
setQueryTimeout
- Specified by:
setQueryTimeoutin interfaceStatement- Throws:
SQLException
-
cancel
- Specified by:
cancelin interfaceStatement- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
clearWarningsX
final void clearWarningsX() -
setCursorName
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
executeX
- Throws:
SqlException
-
getResultSet
- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getUpdateCount
- Specified by:
getUpdateCountin interfaceStatement- Throws:
SQLException
-
getLargeUpdateCount
- Specified by:
getLargeUpdateCountin interfaceStatement- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
setFetchDirection
- Specified by:
setFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchDirection
- Specified by:
getFetchDirectionin interfaceStatement- Throws:
SQLException
-
setFetchSize
- Specified by:
setFetchSizein interfaceStatement- Throws:
SQLException
-
getFetchSize
- Specified by:
getFetchSizein interfaceStatement- Throws:
SQLException
-
getResultSetConcurrency
- Specified by:
getResultSetConcurrencyin interfaceStatement- Throws:
SQLException
-
getResultSetType
- Specified by:
getResultSetTypein interfaceStatement- Throws:
SQLException
-
addBatch
- Specified by:
addBatchin interfaceStatement- Throws:
SQLException
-
clearBatch
- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException
-
executeBatch
- Specified by:
executeBatchin interfaceStatement- Throws:
SQLException
-
executeLargeBatch
- Specified by:
executeLargeBatchin interfaceStatement- Throws:
SQLException
-
executeBatchX
- Throws:
SqlExceptionBatchUpdateException
-
getConnection
- Specified by:
getConnectionin interfaceStatement- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getMoreResultsX
- Throws:
SqlException
-
getGeneratedKeys
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
writeSetSpecialRegister
- Throws:
SqlException
-
readSetSpecialRegister
- Throws:
SqlException
-
writeExecuteImmediate
- Throws:
SqlException
-
readExecuteImmediate
- Throws:
SqlException
-
completeExecuteImmediate
- Specified by:
completeExecuteImmediatein interfaceStatementCallbackInterface
-
readExecuteImmediateForBatch
- Throws:
SqlException
-
writePrepareDescribeOutput
- Throws:
SqlException
-
readPrepareDescribeOutput
- Throws:
SqlException
-
completePrepareDescribeOutput
- Specified by:
completePrepareDescribeOutputin interfaceStatementCallbackInterface
-
writePrepare
- Throws:
SqlException
-
readPrepare
- Throws:
SqlException
-
completePrepare
- Specified by:
completePreparein interfaceStatementCallbackInterface
-
writeOpenQuery
- Throws:
SqlException
-
readOpenQuery
- Throws:
SqlException
-
completeOpenQuery
- Specified by:
completeOpenQueryin interfaceStatementCallbackInterface
-
completeExecuteCallOpenQuery
public void completeExecuteCallOpenQuery(Sqlca sqlca, ClientResultSet resultSet, ColumnMetaData resultSetMetaData, Section generatedSection) - Specified by:
completeExecuteCallOpenQueryin interfaceStatementCallbackInterface
-
writeExecuteCall
void writeExecuteCall(boolean outputExpected, String procedureName, Section section, int fetchSize, boolean suppressResultSets, int resultSetType, ColumnMetaData parameterMetaData, Object[] inputs) throws SqlException - Throws:
SqlException
-
readExecuteCall
- Throws:
SqlException
-
completeExecuteCall
- Specified by:
completeExecuteCallin interfaceStatementCallbackInterface
-
completeExecuteCall
- Specified by:
completeExecuteCallin interfaceStatementCallbackInterface
-
completeExecute
- Specified by:
completeExecutein interfaceStatementCallbackInterface
-
setUpdateCount
public void setUpdateCount(long updateCount) -
setOwner
Designates the owner of this statement, typically a logical statement.- Parameters:
owner- the owning statement, if any
-
getOwner
Returns the owner of this statement, if any.- Returns:
- The designated owner of this statement, or
nullif none.
-
willTickleServer
- Throws:
SqlException
-
flowClose
- Throws:
SqlException
-
flowCloseOutsideUOW
- Throws:
SqlException
-
writeClose
- Throws:
SqlException
-
readClose
- Throws:
SqlException
-
writeCloseResultSets
The connection close processing passes allowAutoCommits=false because if we drove an auto-commits after each statement close, then when we issue close requests on non-held cursors the server would complain that the non-held cursor was already closed from the previous statement's auto-commit. So the solution is to never auto-commit statements during connection close processing. Here's the operative explanation: Given a sequence of open statements S1, S2, .... a logic problem is occurring after S1 close-query drives an auto-commit, and S2 close-query is driven against a non-held cursor. The first auto-commit driven by S1 triggers a callback that closes S2's non-held cursor, and so the subsequent S2 close-query request generates an error from the server saying that the cursor is already closed. This is fixed by passing a flag to our statement close processing that prevents driving additional auto-commits after each statement close. Connection close drives its own final auto-commit.- Parameters:
allowAutoCommits-- Throws:
SqlException
-
writeCloseResultSets
- Throws:
SqlException
-
readCloseResultSets
- Throws:
SqlException
-
readCloseResultSets
- Throws:
SqlException
-
flowCloseRetrievedResultSets
- Throws:
SqlException
-
flowCloseRetrievedResultSetsOutsideUOW
- Throws:
SqlException
-
completeSqlca
- Specified by:
completeSqlcain interfaceStatementCallbackInterface
-
completeExecuteSetStatement
- Specified by:
completeExecuteSetStatementin interfaceStatementCallbackInterface
-
markClosed
void markClosed()This method cleans up client-side resources held by this Statement. The Statement will not be removed from the open statements list and PreparedStatement will also not be removed from the commit and rollback listeners list inorg.apache.derby.client.am.Connection. This method is called from: 1. finalize() - For the finalizer to be called, the Statement should not have any references and so it should have been already removed from the lists. 2.org.apache.derby.client.am.Connection#markStatementsClosedThis method explicitly removes the Statement from open statements list. 3. To close positioned update statements - These statements are not added to the list of open statements. -
markClosed
void markClosed(boolean removeListener) This method cleans up client-side resources held by this Statement. If removeListener is true, the Statement is removed from open statements list and PreparedStatement is also removed from commit and rollback listeners list. This is called from the close methods.- Parameters:
removeListener- if true the Statement will be removed from the open statements list and PreparedStatement will also be removed from commit and rollback listeners list inorg.apache.derby.client.am.Connection.
-
closeEverythingExceptResultSets
private void closeEverythingExceptResultSets(boolean removeListener) Close all resources except for ResultSets. This code was factored out of markClosed() so that closeMeOnCompletion() could close the Statement without having to re-close the already closed ResultSets. -
markPreparedStatementForAutoGeneratedKeysClosed
private void markPreparedStatementForAutoGeneratedKeysClosed() -
markResultSetsClosed
final void markResultSetsClosed(boolean removeListener) Mark all ResultSets associated with this statement as closed.- Parameters:
removeListener- if true the ResultSets will be removed from the commit and rollback listeners list inorg.apache.derby.client.am.Connection.
-
flowExecute
- Throws:
SqlException
-
flowExecuteBatch
- Throws:
SqlExceptionBatchUpdateException
-
writeExecuteCall
- Throws:
SqlException
-
listenToUnitOfWork
public void listenToUnitOfWork()- Specified by:
listenToUnitOfWorkin interfaceUnitOfWorkListener
-
completeLocalCommit
- Specified by:
completeLocalCommitin interfaceUnitOfWorkListener
-
completeLocalRollback
- Specified by:
completeLocalRollbackin interfaceUnitOfWorkListener
-
accumulateWarning
- Specified by:
accumulateWarningin interfaceStatementCallbackInterface
-
markPrepared
private void markPrepared() -
getJdbcStatementInterfaceName
Returns the name of the java.sql interface implemented by this class.- Returns:
- name of java.sql interface
-
parseSqlAndSetSqlModes
- Throws:
SqlException
-
isolateAnyInitialIdentifier
Minion of getStatementToken. If the input string starts with an identifier consisting of letters only (like "select", "update"..),return it, else return supplied string.- Parameters:
sql- input string- Returns:
- identifier or unmodified string
- See Also:
-
getStatementToken
Step past any initial non-significant characters and comments to find first significant SQL token so we can classify statement.- Returns:
- first significant SQL token
- Throws:
SqlException- std exception policy
-
parseUpdateSql
-
checkForAppropriateSqlMode
- Throws:
SqlException
-
checkResultSetCount
Checks that the number of result sets returned by the statement is consistent with the executed type.executeQuery()should return exactly one result set andexecuteUpdate()none. Raises an exception if the result set count does not match the execute type.- Parameters:
executeType- one ofexecuteQueryMethod__,executeUpdateMethod__andexecuteMethod__- Throws:
SqlException- if the number of result sets does not match the execute type
-
checkForStoredProcResultSetCount
Checks that a stored procedure returns the correct number of result sets given its execute type. If the number is incorrect, make sure the transaction is rolled back when auto commit is enabled.- Parameters:
executeType- one ofexecuteQueryMethod__,executeUpdateMethod__andexecuteMethod__- Throws:
SqlException- if the number of result sets does not match the execute type- See Also:
-
checkForClosedStatement
- Throws:
SqlException
-
checkForInvalidBatchedSql
- Throws:
SqlException
-
checkForDuplicateCursorName
- Throws:
SqlException
-
setupCursorNameCacheAndMappings
protected void setupCursorNameCacheAndMappings() -
extractCursorNameFromWhereCurrentOf
-
substituteClientCursorNameWithServerCursorName
protected String substituteClientCursorNameWithServerCursorName(String sql, Section section) throws SqlException - Throws:
SqlException
-
getConnectionCallbackInterface
- Specified by:
getConnectionCallbackInterfacein interfaceStatementCallbackInterface
-
resetCursorNameAndRemoveFromWhereCurrentOfMappings
void resetCursorNameAndRemoveFromWhereCurrentOfMappings() -
mapCursorNameToResultSet
private void mapCursorNameToResultSet() -
parseStorProcReturnedScrollableRowset
- Throws:
SqlException
-
escape
- Throws:
SqlException
-
cacheCursorAttributesToSendOnPrepare
- Throws:
SqlException
-
prepareAutoGeneratedKeysStatement
protected static ClientPreparedStatement prepareAutoGeneratedKeysStatement(ClientConnection cc) throws SqlException - Throws:
SqlException
-
checkAutoGeneratedKeysParameters
- Throws:
SqlException
-
getGuessedResultSetMetaData
- Specified by:
getGuessedResultSetMetaDatain interfaceStatementCallbackInterface
-
isQueryMode
public boolean isQueryMode() -
removeClientCursorNameFromCache
protected void removeClientCursorNameFromCache() -
resultSetCommitting
Convenience method for resultSetCommitting(ClientResultSet, boolean)- Parameters:
closingRS- The ResultSet to be closed- Throws:
SqlException- See Also:
-
resultSetCommitting
Method that checks to see if any other ResultSets are open. If not proceeds with the autocommit.- Parameters:
closingRS- The ResultSet to be closedwriteChain- A Boolean indicating whether this method is part of a chain of write from client to Server- Throws:
SqlException
-
markAutoCommitted
private void markAutoCommitted()Mark all ResultSets associated with this statement as auto-committed. -
closeOnCompletion
/////////////////////////////////////////////////////////////////- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
closeMeOnCompletion
void closeMeOnCompletion() -
isOpen
- Throws:
SQLException
-
resetResultSetList
void resetResultSetList() -
getSection
Provides public access for section_. This is necessary as the section concept is shared between client.am and net. Seems like it really belongs in net as it is tied to the particular protocol used.- Returns:
- section_
-
setSection
Assigns a new value (even null) to section_. The existing section_ (if any) is freed.- Parameters:
s- the section_ to set.
-