org.apache.commons.dbcp

Class DelegatingStatement

public class DelegatingStatement extends AbandonedTrace implements Statement

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.

Version: $Revision: 1.17 $ $Date: 2004/03/06 13:35:31 $

Author: Rodney Waldhoff Glenn L. Nielsen James House Dirk Verbeeck

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
voidaddBatch(String sql)
voidcancel()
voidclearBatch()
voidclearWarnings()
voidclose()
Close this DelegatingStatement, and close any ResultSets that were not explicitly closed.
booleanequals(Object obj)
booleanexecute(String sql)
booleanexecute(String sql, int autoGeneratedKeys)
booleanexecute(String sql, int[] columnIndexes)
booleanexecute(String sql, String[] columnNames)
int[]executeBatch()
ResultSetexecuteQuery(String sql)
intexecuteUpdate(String sql)
intexecuteUpdate(String sql, int autoGeneratedKeys)
intexecuteUpdate(String sql, int[] columnIndexes)
intexecuteUpdate(String sql, String[] columnNames)
ConnectiongetConnection()
StatementgetDelegate()
Returns my underlying Statement.
intgetFetchDirection()
intgetFetchSize()
ResultSetgetGeneratedKeys()
StatementgetInnermostDelegate()
If my underlying Statement is not a DelegatingStatement, returns it, otherwise recursively invokes this method on my delegate.
intgetMaxFieldSize()
intgetMaxRows()
booleangetMoreResults()
booleangetMoreResults(int current)
intgetQueryTimeout()
ResultSetgetResultSet()
intgetResultSetConcurrency()
intgetResultSetHoldability()
intgetResultSetType()
intgetUpdateCount()
SQLWarninggetWarnings()
inthashCode()
voidsetCursorName(String name)
voidsetDelegate(Statement s)
Sets my delegate.
voidsetEscapeProcessing(boolean enable)
voidsetFetchDirection(int direction)
voidsetFetchSize(int rows)
voidsetMaxFieldSize(int max)
voidsetMaxRows(int max)
voidsetQueryTimeout(int seconds)

Constructor Detail

DelegatingStatement

public 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.

Parameters: s the Statement to delegate all calls to. c the DelegatingConnection that created this statement.

Method Detail

addBatch

public void addBatch(String sql)

cancel

public void cancel()

clearBatch

public void clearBatch()

clearWarnings

public void clearWarnings()

close

public void close()
Close this DelegatingStatement, and close any ResultSets that were not explicitly closed.

equals

public boolean equals(Object obj)

execute

public boolean execute(String sql)

execute

public boolean execute(String sql, int autoGeneratedKeys)

execute

public boolean execute(String sql, int[] columnIndexes)

execute

public boolean execute(String sql, String[] columnNames)

executeBatch

public int[] executeBatch()

executeQuery

public ResultSet executeQuery(String sql)

executeUpdate

public int executeUpdate(String sql)

executeUpdate

public int executeUpdate(String sql, int autoGeneratedKeys)

executeUpdate

public int executeUpdate(String sql, int[] columnIndexes)

executeUpdate

public int executeUpdate(String sql, String[] columnNames)

getConnection

public Connection getConnection()

getDelegate

public Statement getDelegate()
Returns my underlying Statement.

Returns: my underlying Statement.

See Also: DelegatingStatement

getFetchDirection

public int getFetchDirection()

getFetchSize

public int getFetchSize()

getGeneratedKeys

public ResultSet getGeneratedKeys()

getInnermostDelegate

public Statement getInnermostDelegate()
If my underlying Statement is not a DelegatingStatement, returns it, otherwise recursively invokes this method on my delegate.

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

getMaxFieldSize

public int getMaxFieldSize()

getMaxRows

public int getMaxRows()

getMoreResults

public boolean getMoreResults()

getMoreResults

public boolean getMoreResults(int current)

getQueryTimeout

public int getQueryTimeout()

getResultSet

public ResultSet getResultSet()

getResultSetConcurrency

public int getResultSetConcurrency()

getResultSetHoldability

public int getResultSetHoldability()

getResultSetType

public int getResultSetType()

getUpdateCount

public int getUpdateCount()

getWarnings

public SQLWarning getWarnings()

hashCode

public int hashCode()

setCursorName

public void setCursorName(String name)

setDelegate

public void setDelegate(Statement s)
Sets my delegate.

setEscapeProcessing

public void setEscapeProcessing(boolean enable)

setFetchDirection

public void setFetchDirection(int direction)

setFetchSize

public void setFetchSize(int rows)

setMaxFieldSize

public void setMaxFieldSize(int max)

setMaxRows

public void setMaxRows(int max)

setQueryTimeout

public void setQueryTimeout(int seconds)
Copyright © 2001-2003 Apache Software Foundation. Documenation generated February 19 2008.