org.apache.commons.dbcp
public class DelegatingStatement extends AbandonedTrace implements 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.
Version: $Revision: 1.17 $ $Date: 2004/03/06 13:35:31 $
Constructor Summary | |
---|---|
DelegatingStatement(DelegatingConnection c, Statement s)
Create a wrapper for the Statement which traces this
Statement to the Connection which created it and the
code which created it.
|
Method Summary | |
---|---|
void | addBatch(String sql) |
void | cancel() |
void | clearBatch() |
void | clearWarnings() |
void | close()
Close this DelegatingStatement, and close
any ResultSets that were not explicitly closed. |
boolean | equals(Object obj) |
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) |
Connection | getConnection() |
Statement | getDelegate()
Returns my underlying Statement. |
int | getFetchDirection() |
int | getFetchSize() |
ResultSet | getGeneratedKeys() |
Statement | getInnermostDelegate()
If my underlying Statement is not a
DelegatingStatement, returns it,
otherwise recursively invokes this method on
my delegate.
|
int | getMaxFieldSize() |
int | getMaxRows() |
boolean | getMoreResults() |
boolean | getMoreResults(int current) |
int | getQueryTimeout() |
ResultSet | getResultSet() |
int | getResultSetConcurrency() |
int | getResultSetHoldability() |
int | getResultSetType() |
int | getUpdateCount() |
SQLWarning | getWarnings() |
int | hashCode() |
void | setCursorName(String name) |
void | setDelegate(Statement s) Sets my delegate. |
void | setEscapeProcessing(boolean enable) |
void | setFetchDirection(int direction) |
void | setFetchSize(int rows) |
void | setMaxFieldSize(int max) |
void | setMaxRows(int max) |
void | setQueryTimeout(int seconds) |
Parameters: s the Statement to delegate all calls to. c the DelegatingConnection that created this statement.
Returns: my underlying Statement.
See Also: DelegatingStatement
Hence this method will return the first delegate that is not a DelegatingStatement or null when no non-DelegatingStatement delegate can be found by transversing this chain.
This method is useful when you may have nested DelegatingStatements, and you want to make sure to obtain a "genuine" Statement.
See Also: DelegatingStatement