Package org.apache.tomcat.dbcp.dbcp2
Class DelegatingStatement
java.lang.Object
org.apache.tomcat.dbcp.dbcp2.AbandonedTrace
org.apache.tomcat.dbcp.dbcp2.DelegatingStatement
- All Implemented Interfaces:
- AutoCloseable,- Statement,- Wrapper,- TrackedUse
- Direct Known Subclasses:
- DelegatingPreparedStatement
A base delegating implementation of 
Statement.
 
 All of the methods from the Statement interface simply check to see that the Statement is active, and
 call the corresponding method on the "delegate" provided in my constructor.
 
Extends AbandonedTrace to implement Statement tracking and logging of code which created the Statement. Tracking the Statement ensures that the Connection which created it can close any open Statement's on Connection close.
- Since:
- 2.0
- 
Field SummaryFields inherited from interface java.sql.StatementCLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
- 
Constructor SummaryConstructorsConstructorDescriptionDelegatingStatement(DelegatingConnection<?> connection, Statement statement) Create a wrapper for the Statement which traces this Statement to the Connection which created it and the code which created it.
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivate()voidvoidcancel()protected voidvoidvoidvoidclose()Close this DelegatingStatement, and close any ResultSets that were not explicitly closed.voidbooleanbooleanbooleanbooleanint[]long[]longexecuteLargeUpdate(String sql) longexecuteLargeUpdate(String sql, int autoGeneratedKeys) longexecuteLargeUpdate(String sql, int[] columnIndexes) longexecuteLargeUpdate(String sql, String[] columnNames) executeQuery(String sql) intexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndexes) intexecuteUpdate(String sql, String[] columnNames) protected voidfinalize()protected DelegatingConnection<?>Returns my underlyingStatement.intintIf my underlyingStatementis not aDelegatingStatement, returns it, otherwise recursively invokes this method on my delegate.longlongintintbooleanbooleangetMoreResults(int current) intintintintintprotected voidbooleanisClosed()protected booleanbooleanbooleanbooleanisWrapperFor(Class<?> iface) voidprotected voidsetClosedInternal(boolean closed) voidsetCursorName(String name) voidsetDelegate(Statement statement) Sets my delegate.voidsetEscapeProcessing(boolean enable) voidsetFetchDirection(int direction) voidsetFetchSize(int rows) voidsetLargeMaxRows(long max) voidsetMaxFieldSize(int max) voidsetMaxRows(int max) voidsetPoolable(boolean poolable) voidsetQueryTimeout(int seconds) toString()Returns a String representation of this object.<T> TMethods inherited from class org.apache.tomcat.dbcp.dbcp2.AbandonedTraceaddTrace, clearTrace, close, getLastUsed, getLastUsedInstant, getTrace, removeThisTrace, removeTrace, setLastUsed, setLastUsed, setLastUsedMethods inherited from class java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.sql.StatementenquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isSimpleIdentifier
- 
Constructor Details- 
DelegatingStatementCreate a wrapper for the Statement which traces this Statement to the Connection which created it and the code which created it.- Parameters:
- statement- the- Statementto delegate all calls to.
- connection- the- DelegatingConnectionthat created this statement.
 
 
- 
- 
Method Details- 
activate- Throws:
- SQLException- thrown by the delegating statement.
- Since:
- 2.4.0 made public, was protected in 2.3.0.
 
- 
addBatch- Specified by:
- addBatchin interface- Statement
- Throws:
- SQLException
 
- 
cancel- Specified by:
- cancelin interface- Statement
- Throws:
- SQLException
 
- 
checkOpen- Throws:
- SQLException
 
- 
clearBatch- Specified by:
- clearBatchin interface- Statement
- Throws:
- SQLException
 
- 
clearWarnings- Specified by:
- clearWarningsin interface- Statement
- Throws:
- SQLException
 
- 
closeClose this DelegatingStatement, and close any ResultSets that were not explicitly closed.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Statement
- Overrides:
- closein class- AbandonedTrace
- Throws:
- SQLException- Ignored here, for subclasses.
 
- 
closeOnCompletion- Specified by:
- closeOnCompletionin interface- Statement
- Throws:
- SQLException
 
- 
execute- Specified by:
- executein interface- Statement
- Throws:
- SQLException
 
- 
execute- Specified by:
- executein interface- Statement
- Throws:
- SQLException
 
- 
execute- Specified by:
- executein interface- Statement
- Throws:
- SQLException
 
- 
execute- Specified by:
- executein interface- Statement
- Throws:
- SQLException
 
- 
executeBatch- Specified by:
- executeBatchin interface- Statement
- Throws:
- SQLException
 
- 
executeLargeBatch- Specified by:
- executeLargeBatchin interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
executeLargeUpdate- Specified by:
- executeLargeUpdatein interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
executeLargeUpdate- Specified by:
- executeLargeUpdatein interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
executeLargeUpdate- Specified by:
- executeLargeUpdatein interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
executeLargeUpdate- Specified by:
- executeLargeUpdatein interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
executeQuery- Specified by:
- executeQueryin interface- Statement
- Throws:
- SQLException
 
- 
executeUpdate- Specified by:
- executeUpdatein interface- Statement
- Throws:
- SQLException
 
- 
executeUpdate- Specified by:
- executeUpdatein interface- Statement
- Throws:
- SQLException
 
- 
executeUpdate- Specified by:
- executeUpdatein interface- Statement
- Throws:
- SQLException
 
- 
executeUpdate- Specified by:
- executeUpdatein interface- Statement
- Throws:
- SQLException
 
- 
finalize
- 
getConnection- Specified by:
- getConnectionin interface- Statement
- Throws:
- SQLException
 
- 
getConnectionInternal
- 
getDelegateReturns my underlyingStatement.- Returns:
- my underlying Statement.
- See Also:
 
- 
getFetchDirection- Specified by:
- getFetchDirectionin interface- Statement
- Throws:
- SQLException
 
- 
getFetchSize- Specified by:
- getFetchSizein interface- Statement
- Throws:
- SQLException
 
- 
getGeneratedKeys- Specified by:
- getGeneratedKeysin interface- Statement
- Throws:
- SQLException
 
- 
getInnermostDelegateIf my underlyingStatementis not aDelegatingStatement, returns it, otherwise recursively invokes this method on my delegate.Hence this method will return the first delegate that is not a DelegatingStatementornullwhen no non-DelegatingStatementdelegate can be found by traversing this chain.This method is useful when you may have nested DelegatingStatements, and you want to make sure to obtain a "genuine"Statement.- Returns:
- The innermost delegate.
- See Also:
 
- 
getLargeMaxRows- Specified by:
- getLargeMaxRowsin interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
getLargeUpdateCount- Specified by:
- getLargeUpdateCountin interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
getMaxFieldSize- Specified by:
- getMaxFieldSizein interface- Statement
- Throws:
- SQLException
 
- 
getMaxRows- Specified by:
- getMaxRowsin interface- Statement
- Throws:
- SQLException
 
- 
getMoreResults- Specified by:
- getMoreResultsin interface- Statement
- Throws:
- SQLException
 
- 
getMoreResults- Specified by:
- getMoreResultsin interface- Statement
- Throws:
- SQLException
 
- 
getQueryTimeout- Specified by:
- getQueryTimeoutin interface- Statement
- Throws:
- SQLException
 
- 
getResultSet- Specified by:
- getResultSetin interface- Statement
- Throws:
- SQLException
 
- 
getResultSetConcurrency- Specified by:
- getResultSetConcurrencyin interface- Statement
- Throws:
- SQLException
 
- 
getResultSetHoldability- Specified by:
- getResultSetHoldabilityin interface- Statement
- Throws:
- SQLException
 
- 
getResultSetType- Specified by:
- getResultSetTypein interface- Statement
- Throws:
- SQLException
 
- 
getUpdateCount- Specified by:
- getUpdateCountin interface- Statement
- Throws:
- SQLException
 
- 
getWarnings- Specified by:
- getWarningsin interface- Statement
- Throws:
- SQLException
 
- 
handleException- Throws:
- SQLException
 
- 
isClosed- Specified by:
- isClosedin interface- Statement
- Throws:
- SQLException
 
- 
isClosedInternalprotected boolean isClosedInternal()
- 
isCloseOnCompletion- Specified by:
- isCloseOnCompletionin interface- Statement
- Throws:
- SQLException
 
- 
isPoolable- Specified by:
- isPoolablein interface- Statement
- Throws:
- SQLException
 
- 
isWrapperFor- Specified by:
- isWrapperForin interface- Wrapper
- Throws:
- SQLException
 
- 
passivate- Throws:
- SQLException- thrown by the delegating statement.
- Since:
- 2.4.0 made public, was protected in 2.3.0.
 
- 
setClosedInternalprotected void setClosedInternal(boolean closed) 
- 
setCursorName- Specified by:
- setCursorNamein interface- Statement
- Throws:
- SQLException
 
- 
setDelegateSets my delegate.- Parameters:
- statement- my delegate.
 
- 
setEscapeProcessing- Specified by:
- setEscapeProcessingin interface- Statement
- Throws:
- SQLException
 
- 
setFetchDirection- Specified by:
- setFetchDirectionin interface- Statement
- Throws:
- SQLException
 
- 
setFetchSize- Specified by:
- setFetchSizein interface- Statement
- Throws:
- SQLException
 
- 
setLargeMaxRows- Specified by:
- setLargeMaxRowsin interface- Statement
- Throws:
- SQLException
- Since:
- 2.5.0
 
- 
setMaxFieldSize- Specified by:
- setMaxFieldSizein interface- Statement
- Throws:
- SQLException
 
- 
setMaxRows- Specified by:
- setMaxRowsin interface- Statement
- Throws:
- SQLException
 
- 
setPoolable- Specified by:
- setPoolablein interface- Statement
- Throws:
- SQLException
 
- 
setQueryTimeout- Specified by:
- setQueryTimeoutin interface- Statement
- Throws:
- SQLException
 
- 
toStringReturns a String representation of this object.
- 
unwrap- Specified by:
- unwrapin interface- Wrapper
- Throws:
- SQLException
 
 
-