Package org.apache.tomcat.dbcp.dbcp2
Class PoolablePreparedStatement<K>
- java.lang.Object
-
- org.apache.tomcat.dbcp.dbcp2.AbandonedTrace
-
- org.apache.tomcat.dbcp.dbcp2.DelegatingStatement
-
- org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement
-
- org.apache.tomcat.dbcp.dbcp2.PoolablePreparedStatement<K>
-
- Type Parameters:
K
- the key type
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.PreparedStatement
,java.sql.Statement
,java.sql.Wrapper
,TrackedUse
public class PoolablePreparedStatement<K> extends DelegatingPreparedStatement
ADelegatingPreparedStatement
that cooperates withPoolingConnection
to implement a pool ofPreparedStatement
s.My
close()
method returns me to my containing pool. (SeePoolingConnection
.)- Since:
- 2.0
- See Also:
PoolingConnection
-
-
Constructor Summary
Constructors Constructor Description PoolablePreparedStatement(java.sql.PreparedStatement stmt, K key, KeyedObjectPool<K,PoolablePreparedStatement<K>> pool, DelegatingConnection<?> conn)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
void
addBatch()
Add batch.void
clearBatch()
Clear Batch.void
close()
Return me to my pool.void
passivate()
-
Methods inherited from class org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement
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, toString
-
Methods inherited from class org.apache.tomcat.dbcp.dbcp2.DelegatingStatement
addBatch, cancel, checkOpen, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, finalize, getConnection, getConnectionInternal, getDelegate, getFetchDirection, getFetchSize, getGeneratedKeys, getInnermostDelegate, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, handleException, isClosed, isClosedInternal, isCloseOnCompletion, isPoolable, isWrapperFor, setClosedInternal, setCursorName, setDelegate, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrap
-
Methods inherited from class org.apache.tomcat.dbcp.dbcp2.AbandonedTrace
addTrace, clearTrace, getLastUsed, getLastUsedInstant, getTrace, removeThisTrace, removeTrace, setLastUsed, setLastUsed, setLastUsed
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearWarnings, closeOnCompletion, 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, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
Constructor Detail
-
PoolablePreparedStatement
public PoolablePreparedStatement(java.sql.PreparedStatement stmt, K key, KeyedObjectPool<K,PoolablePreparedStatement<K>> pool, DelegatingConnection<?> 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
-
activate
public void activate() throws java.sql.SQLException
- Overrides:
activate
in classDelegatingStatement
- Throws:
java.sql.SQLException
- thrown by the delegating statement.
-
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
-
passivate
public void passivate() throws java.sql.SQLException
- Overrides:
passivate
in classDelegatingStatement
- Throws:
java.sql.SQLException
- thrown by the delegating statement.
-
-