org.apache.commons.dbcp
Class PoolablePreparedStatement

java.lang.Object
  |
  +--org.apache.commons.dbcp.AbandonedTrace
        |
        +--org.apache.commons.dbcp.DelegatingPreparedStatement
              |
              +--org.apache.commons.dbcp.PoolablePreparedStatement
All Implemented Interfaces:
java.sql.PreparedStatement, java.sql.Statement

public class PoolablePreparedStatement
extends DelegatingPreparedStatement
implements java.sql.PreparedStatement

A DelegatingPreparedStatement that cooperates with PoolingConnection to implement a pool of PreparedStatements.

My close() method returns me to my containing pool. (See PoolingConnection.)

Version:
$Id: PoolablePreparedStatement.java,v 1.3 2002/05/16 21:25:38 glenn Exp $
Author:
Rodney Waldhoff
, Glenn L. Nielsen , James House (james@interobjective.com)
See Also:
PoolingConnection

Field Summary
protected  java.sql.Connection _conn
          The Connection from which I was created.
protected  java.lang.Object _key
          My "key" as used by KeyedObjectPool.
protected  org.apache.commons.pool.KeyedObjectPool _pool
          The KeyedObjectPool from which I was obtained.
 
Fields inherited from class org.apache.commons.dbcp.DelegatingPreparedStatement
_closed, _stmt
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Constructor Summary
PoolablePreparedStatement(java.sql.PreparedStatement stmt, java.lang.Object key, org.apache.commons.pool.KeyedObjectPool pool, java.sql.Connection conn)
          Constructor
 
Method Summary
 void close()
          Return me to my pool.
 java.sql.Connection getConnection()
          Return the Connection from which I was created.
 
Methods inherited from class org.apache.commons.dbcp.DelegatingPreparedStatement
activate, addBatch, addBatch, cancel, checkOpen, clearBatch, clearParameters, clearWarnings, execute, execute, executeBatch, executeQuery, executeQuery, executeUpdate, executeUpdate, getDelegate, getFetchDirection, getFetchSize, getInnermostDelegate, getMaxFieldSize, getMaxRows, getMetaData, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetType, getUpdateCount, getWarnings, passivate, setArray, setAsciiStream, setBigDecimal, setBinaryStream, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setClob, setCursorName, setDate, setDate, setDelegate, setDouble, setEscapeProcessing, setFetchDirection, setFetchSize, setFloat, setInt, setLong, setMaxFieldSize, setMaxRows, setNull, setNull, setObject, setObject, setObject, setQueryTimeout, setRef, setShort, setString, setTime, setTime, setTimestamp, setTimestamp
 
Methods inherited from class org.apache.commons.dbcp.AbandonedTrace
addTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.PreparedStatement
addBatch, clearParameters, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setBigDecimal, setBinaryStream, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNull, setNull, setObject, setObject, setObject, setRef, setShort, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 

Field Detail

_conn

protected java.sql.Connection _conn
The Connection from which I was created.


_key

protected java.lang.Object _key
My "key" as used by KeyedObjectPool.


_pool

protected org.apache.commons.pool.KeyedObjectPool _pool
The KeyedObjectPool from which I was obtained.

Constructor Detail

PoolablePreparedStatement

public PoolablePreparedStatement(java.sql.PreparedStatement stmt,
                                 java.lang.Object key,
                                 org.apache.commons.pool.KeyedObjectPool pool,
                                 java.sql.Connection conn)
Constructor

Parameters:
stmt - my underlying PreparedStatement
key - my key" as used by KeyedObjectPool
pool - the KeyedObjectPool from which I was obtained.
conn - the Connection from which I was created
Method Detail

close

public void close()
           throws java.sql.SQLException
Return me to my pool.

Specified by:
close in interface java.sql.Statement
Overrides:
close in class DelegatingPreparedStatement
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Return the Connection from which I was created.

Specified by:
getConnection in interface java.sql.Statement
Overrides:
getConnection in class DelegatingPreparedStatement
java.sql.SQLException


Copyright © 2001 Apache Software Foundation. Documenation generated August 12 2002.