|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsnaq.db.CacheConnection
public final class CacheConnection
Connection
wrapper that implements statement caching.
CachedStatement
,
CachedPreparedStatement
,
CachedCallableStatement
Field Summary |
---|
Fields inherited from interface java.sql.Connection |
---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
---|---|
CacheConnection(ConnectionPool pool,
Connection con)
Creates a new CacheConnection object, using the supplied Connection . |
Method Summary | ||
---|---|---|
void |
clearWarnings()
|
|
void |
close()
Overrides method to provide caching support. |
|
void |
commit()
|
|
Array |
createArrayOf(String typeName,
Object[] elements)
|
|
Blob |
createBlob()
|
|
Clob |
createClob()
|
|
NClob |
createNClob()
|
|
SQLXML |
createSQLXML()
|
|
Statement |
createStatement()
Overrides method to provide caching support. |
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Overrides method to provide caching support. |
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Overrides method to provide caching support. |
|
Struct |
createStruct(String typeName,
Object[] attributes)
|
|
boolean |
getAutoCommit()
|
|
String |
getCatalog()
|
|
Properties |
getClientInfo()
|
|
String |
getClientInfo(String name)
|
|
Connection |
getConnection()
|
|
Connection |
getDelegateConnection()
Returns the delegate Connection instance for which this provides
a wrapper. |
|
int |
getHoldability()
|
|
DatabaseMetaData |
getMetaData()
|
|
int |
getOpenCallableStatementCount()
Returns the current number of CallableStatement instances that are in use. |
|
int |
getOpenNonCachableStatementCount()
Returns the current number of non-cachable statements that are in use. |
|
int |
getOpenPreparedStatementCount()
Returns the current number of PreparedStatement instances that
are in use (not including CallableStatement instances). |
|
int |
getOpenStatementCount()
Returns the current number of Statement instances that are in use
(not including PreparedStatement or CallableStatement instances). |
|
int |
getSpareCallableStatementCount()
Returns the current number of spare CallableStatement instances that are cached. |
|
int |
getSparePreparedStatementCount()
Returns the current number of spare PreparedStatement instances that are cached. |
|
int |
getSpareStatementCount()
Returns the current number of spare Statements that are cached. |
|
int |
getTransactionIsolation()
|
|
Map<String,Class<?>> |
getTypeMap()
|
|
SQLWarning |
getWarnings()
|
|
boolean |
isCachingAllStatements()
Returns whether caching of all Statement instances is enabled. |
|
boolean |
isCachingCallableStatements()
Returns whether caching of CallableStatement instances is enabled. |
|
boolean |
isCachingPreparedStatements()
Returns whether caching of PreparedStatement instances is enabled. |
|
boolean |
isCachingStatements()
Returns whether caching of standard Statement instances is enabled. |
|
boolean |
isClosed()
|
|
boolean |
isDirty()
Determines if this object is "dirty" (i.e. |
|
boolean |
isReadOnly()
|
|
boolean |
isValid(int timeout)
|
|
boolean |
isWrapperFor(Class<?> iface)
|
|
String |
nativeSQL(String sql)
|
|
CallableStatement |
prepareCall(String sql)
Overrides method to provide caching support. |
|
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
Overrides method to provide caching support. |
|
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Overrides method to provide caching support. |
|
PreparedStatement |
prepareStatement(String sql)
Overrides method to provide caching support. |
|
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys)
|
|
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes)
|
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
Overrides method to provide caching support. |
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Overrides method to provide caching support. |
|
PreparedStatement |
prepareStatement(String sql,
String[] columnNames)
|
|
void |
recycle()
Puts the connection back in a state where it can be reused. |
|
void |
release()
Destroys the wrapped Connection instance. |
|
void |
releaseSavepoint(Savepoint savepoint)
|
|
void |
rollback()
|
|
void |
rollback(Savepoint savepoint)
|
|
void |
setAutoCommit(boolean autoCommit)
|
|
void |
setCacheAll(boolean cache)
Sets whether to use caching for all types of Statement. |
|
void |
setCacheCallableStatements(boolean cache)
Sets whether to use caching for CallableStatement instances. |
|
void |
setCachePreparedStatements(boolean cache)
Sets whether to use caching for PreparedStatement instances. |
|
void |
setCacheStatements(boolean cache)
Sets whether to use caching for Statement instances. |
|
void |
setCatalog(String catalog)
|
|
void |
setClientInfo(Properties properties)
|
|
void |
setClientInfo(String name,
String value)
|
|
void |
setHoldability(int holdability)
|
|
void |
setReadOnly(boolean readOnly)
|
|
Savepoint |
setSavepoint()
|
|
Savepoint |
setSavepoint(String name)
|
|
void |
setTransactionIsolation(int level)
|
|
void |
setTypeMap(Map<String,Class<?>> map)
|
|
void |
statementClosed(CachedStatement s)
Callback invoked when a CachedStatement is closed. |
|
|
unwrap(Class<T> iface)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CacheConnection(ConnectionPool pool, Connection con)
CacheConnection
object, using the supplied Connection
.
pool
- ConnectionPool
to which this CacheConnection
belongscon
- Connection
instance to which database calls should be delegatedMethod Detail |
---|
public void setCacheStatements(boolean cache)
Statement
instances.
cache
- whether to cache Statement
instancespublic void setCachePreparedStatements(boolean cache)
PreparedStatement
instances.
cache
- whether to cache PreparedStatement
instancespublic void setCacheCallableStatements(boolean cache)
CallableStatement
instances.
cache
- whether to cache CallableStatement
instancespublic void setCacheAll(boolean cache)
cache
- whether to cache all types of statementpublic boolean isCachingAllStatements()
Statement
instances is enabled.
public boolean isCachingStatements()
Statement
instances is enabled.
Statement
instances are flagged for caching, false otherwise.public boolean isCachingPreparedStatements()
PreparedStatement
instances is enabled.
PreparedStatement
instances are flagged for caching, false otherwise.public boolean isCachingCallableStatements()
CallableStatement
instances is enabled.
CallableStatement
instances are flagged for caching, false otherwise.public Connection getDelegateConnection()
Connection
instance for which this provides
a wrapper. This is provided as a convenience method for using database-specific
features for which the Connection
object needs to be upcast.
(e.g. to use Oracle-specific features needs to be cast to
oracle.jdbc.OracleConnection
).
To maintain the stability of the pooling system it is important that the
raw connection is not destabilized when used in this way.
Connection
instance being used for database access.public Statement createStatement() throws SQLException
createStatement
in interface Connection
SQLException
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
createStatement
in interface Connection
SQLException
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
createStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql) throws SQLException
prepareStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareStatement
in interface Connection
SQLException
public CallableStatement prepareCall(String sql) throws SQLException
prepareCall
in interface Connection
SQLException
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareCall
in interface Connection
SQLException
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareCall
in interface Connection
SQLException
public void statementClosed(CachedStatement s) throws SQLException
CachedStatement
is closed.
This method should only be called by CachedStatement
instances.
SQLException
public String nativeSQL(String sql) throws SQLException
nativeSQL
in interface Connection
SQLException
public void setAutoCommit(boolean autoCommit) throws SQLException
setAutoCommit
in interface Connection
SQLException
public boolean getAutoCommit() throws SQLException
getAutoCommit
in interface Connection
SQLException
public void commit() throws SQLException
commit
in interface Connection
SQLException
public void rollback() throws SQLException
rollback
in interface Connection
SQLException
public void recycle() throws SQLException
ConnectionPool
instances.
recycle
in interface Reusable
SQLException
public boolean isDirty()
isDirty
in interface Reusable
public void close() throws SQLException
close
in interface Connection
SQLException
public int getSpareStatementCount()
public int getOpenStatementCount()
Statement
instances that are in use
(not including PreparedStatement
or CallableStatement
instances).
public int getSparePreparedStatementCount()
PreparedStatement
instances that are cached.
public int getOpenPreparedStatementCount()
PreparedStatement
instances that
are in use (not including CallableStatement
instances).
public int getSpareCallableStatementCount()
CallableStatement
instances that are cached.
public int getOpenCallableStatementCount()
CallableStatement
instances that are in use.
public int getOpenNonCachableStatementCount()
PreparedStatement
instances are non-cachable
by virtue of a request made at creation for support for auto-generated keys.)
prepareStatement(String, int)
,
prepareStatement(String, int[])
,
prepareStatement(String, String[])
public void release() throws SQLException
Connection
instance.
This method should only be called by ConnectionPool
instances.
SQLException
public boolean isClosed() throws SQLException
isClosed
in interface Connection
SQLException
public DatabaseMetaData getMetaData() throws SQLException
getMetaData
in interface Connection
SQLException
public void setReadOnly(boolean readOnly) throws SQLException
setReadOnly
in interface Connection
SQLException
public boolean isReadOnly() throws SQLException
isReadOnly
in interface Connection
SQLException
public void setCatalog(String catalog) throws SQLException
setCatalog
in interface Connection
SQLException
public String getCatalog() throws SQLException
getCatalog
in interface Connection
SQLException
public void setTransactionIsolation(int level) throws SQLException
setTransactionIsolation
in interface Connection
SQLException
public int getTransactionIsolation() throws SQLException
getTransactionIsolation
in interface Connection
SQLException
public SQLWarning getWarnings() throws SQLException
getWarnings
in interface Connection
SQLException
public void clearWarnings() throws SQLException
clearWarnings
in interface Connection
SQLException
public Map<String,Class<?>> getTypeMap() throws SQLException
getTypeMap
in interface Connection
SQLException
public void setTypeMap(Map<String,Class<?>> map) throws SQLException
setTypeMap
in interface Connection
SQLException
public void setHoldability(int holdability) throws SQLException
setHoldability
in interface Connection
SQLException
public int getHoldability() throws SQLException
getHoldability
in interface Connection
SQLException
public Savepoint setSavepoint() throws SQLException
setSavepoint
in interface Connection
SQLException
public Savepoint setSavepoint(String name) throws SQLException
setSavepoint
in interface Connection
SQLException
public void rollback(Savepoint savepoint) throws SQLException
rollback
in interface Connection
SQLException
public void releaseSavepoint(Savepoint savepoint) throws SQLException
releaseSavepoint
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
prepareStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
prepareStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
prepareStatement
in interface Connection
SQLException
public Connection getConnection() throws SQLException
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public Clob createClob() throws SQLException
createClob
in interface Connection
SQLException
public Blob createBlob() throws SQLException
createBlob
in interface Connection
SQLException
public NClob createNClob() throws SQLException
createNClob
in interface Connection
SQLException
public SQLXML createSQLXML() throws SQLException
createSQLXML
in interface Connection
SQLException
public boolean isValid(int timeout) throws SQLException
isValid
in interface Connection
SQLException
public void setClientInfo(String name, String value) throws SQLClientInfoException
setClientInfo
in interface Connection
SQLClientInfoException
public void setClientInfo(Properties properties) throws SQLClientInfoException
setClientInfo
in interface Connection
SQLClientInfoException
public String getClientInfo(String name) throws SQLException
getClientInfo
in interface Connection
SQLException
public Properties getClientInfo() throws SQLException
getClientInfo
in interface Connection
SQLException
public Array createArrayOf(String typeName, Object[] elements) throws SQLException
createArrayOf
in interface Connection
SQLException
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
createStruct
in interface Connection
SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |