Package org.apache.commons.dbcp
Class PoolablePreparedStatement
- java.lang.Object
-
- org.apache.commons.dbcp.AbandonedTrace
-
- org.apache.commons.dbcp.DelegatingStatement
-
- org.apache.commons.dbcp.DelegatingPreparedStatement
-
- org.apache.commons.dbcp.PoolablePreparedStatement
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.PreparedStatement
,java.sql.Statement
,java.sql.Wrapper
public class PoolablePreparedStatement extends DelegatingPreparedStatement implements java.sql.PreparedStatement
ADelegatingPreparedStatement
that cooperates withPoolingConnection
to implement a pool ofPreparedStatement
s.My
close()
method returns me to my containing pool. (SeePoolingConnection
.)- Version:
- $Revision: 745860 $ $Date: 2009-02-19 08:45:07 -0500 (Thu, 19 Feb 2009) $
- Author:
- Rodney Waldhoff, Glenn L. Nielsen, James House, Dirk Verbeeck
- See Also:
PoolingConnection
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Object
_key
My "key" as used byKeyedObjectPool
.protected org.apache.commons.pool.KeyedObjectPool
_pool
TheKeyedObjectPool
from which I was obtained.-
Fields inherited from class org.apache.commons.dbcp.DelegatingStatement
_closed, _conn, _stmt
-
-
Constructor Summary
Constructors Constructor Description PoolablePreparedStatement(java.sql.PreparedStatement stmt, java.lang.Object key, org.apache.commons.pool.KeyedObjectPool pool, java.sql.Connection conn)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate()
void
addBatch()
Add batch.void
clearBatch()
Clear Batch.void
close()
Return me to my pool.void
closeOnCompletion()
boolean
isCloseOnCompletion()
protected void
passivate()
-
Methods inherited from class org.apache.commons.dbcp.DelegatingPreparedStatement
clearParameters, equals, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDelegate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL, toString
-
Methods inherited from class org.apache.commons.dbcp.DelegatingStatement
addBatch, cancel, checkOpen, clearWarnings, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getDelegate, getFetchDirection, getFetchSize, getGeneratedKeys, getInnermostDelegate, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, handleException, hashCode, isClosed, isPoolable, isWrapperFor, setCursorName, setDelegate, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrap
-
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, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.sql.PreparedStatement
clearParameters, execute, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearWarnings, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
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 underlyingPreparedStatement
key
- my key" as used byKeyedObjectPool
pool
- theKeyedObjectPool
from which I was obtained.conn
- theConnection
from which I was created
-
-
Method Detail
-
addBatch
public void addBatch() throws java.sql.SQLException
Add batch.- Specified by:
addBatch
in interfacejava.sql.PreparedStatement
- Overrides:
addBatch
in classDelegatingPreparedStatement
- Throws:
java.sql.SQLException
-
clearBatch
public void clearBatch() throws java.sql.SQLException
Clear Batch.- Specified by:
clearBatch
in interfacejava.sql.Statement
- Overrides:
clearBatch
in classDelegatingStatement
- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException
Return me to my pool.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.sql.Statement
- Overrides:
close
in classDelegatingStatement
- Throws:
java.sql.SQLException
-
activate
protected void activate() throws java.sql.SQLException
- Overrides:
activate
in classDelegatingStatement
- Throws:
java.sql.SQLException
-
passivate
protected void passivate() throws java.sql.SQLException
- Overrides:
passivate
in classDelegatingStatement
- Throws:
java.sql.SQLException
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws java.sql.SQLException
- Specified by:
isCloseOnCompletion
in interfacejava.sql.Statement
- Overrides:
isCloseOnCompletion
in classDelegatingPreparedStatement
- Throws:
java.sql.SQLException
-
closeOnCompletion
public void closeOnCompletion() throws java.sql.SQLException
- Specified by:
closeOnCompletion
in interfacejava.sql.Statement
- Overrides:
closeOnCompletion
in classDelegatingPreparedStatement
- Throws:
java.sql.SQLException
-
-