org.enhydra.jdbc.standard
Class StandardConnectionHandle
java.lang.Object
org.enhydra.jdbc.util.JdbcUtil
org.enhydra.jdbc.core.CoreConnection
org.enhydra.jdbc.standard.StandardConnectionHandle
- All Implemented Interfaces:
- Connection, Wrapper
- Direct Known Subclasses:
- InformixConnectionHandle, StandardXAConnectionHandle, SybaseConnectionHandle
public class StandardConnectionHandle
- extends CoreConnection
This is an implementation of java.sql.Connection which simply
delegates almost everything to an underlying physical implemention
of the same interface.
It relies on a StandardPooledConnection to create it and to supply the
physical connection and a cache of PreparedStatements. This class will
try to re-use PreparedStatements wherever possible and will add to the
cache when totally new PreparedStatements get created.
| Fields inherited from class org.enhydra.jdbc.util.JdbcUtil |
log |
|
Method Summary |
void |
catchInvoke(SQLException e)
Exception management : catch or throw the exception |
void |
close()
Closes this StandardConnectionHandle and prevents it
from being reused. |
protected PreparedStatement |
createPreparedStatement(String sql,
int autogeneratedkeys)
|
protected PreparedStatement |
createPreparedStatement(String sql,
int type,
int concurrency,
int holdability)
|
Statement |
createStatement()
|
Statement |
createStatementWrapper()
|
boolean |
isClosed()
|
void |
preInvoke()
Pre-invokation of the delegation, in case of connection is
closed, we throw an exception |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
|
PreparedStatement |
prepareStatement(String sql)
Creates a PreparedStatement for the given SQL. |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
Creates a PreparedStatement for the given SQL, type and concurrency. |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
protected void |
setupPreparedStatementCache()
|
| Methods inherited from class org.enhydra.jdbc.core.CoreConnection |
clearWarnings, commit, createStatement, createStatement, getAutoCommit, getCatalog, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Connection |
createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, getClientInfo, getClientInfo, isValid, setClientInfo, setClientInfo |
masterPrepStmtCache
protected Hashtable masterPrepStmtCache
preparedStatementCache
protected LRUCache preparedStatementCache
inUse
public Hashtable inUse
isReallyUsed
public boolean isReallyUsed
StandardConnectionHandle
public StandardConnectionHandle(StandardPooledConnection pooledCon,
Hashtable preparedStatementCache,
int preparedStmtCacheSize)
- Constructor.
setupPreparedStatementCache
protected void setupPreparedStatementCache()
preInvoke
public void preInvoke()
throws SQLException
- Pre-invokation of the delegation, in case of connection is
closed, we throw an exception
- Specified by:
preInvoke in class CoreConnection
- Throws:
SQLException
catchInvoke
public void catchInvoke(SQLException e)
throws SQLException
- Exception management : catch or throw the exception
- Specified by:
catchInvoke in class CoreConnection
- Throws:
SQLException
close
public void close()
throws SQLException
- Closes this StandardConnectionHandle and prevents it
from being reused. It also returns used PreparedStatements
to the PreparedStatement cache and notifies all listeners.
- Specified by:
close in interface Connection- Overrides:
close in class CoreConnection
- Throws:
SQLException
createPreparedStatement
protected PreparedStatement createPreparedStatement(String sql,
int type,
int concurrency,
int holdability)
throws SQLException
- Throws:
SQLException
createPreparedStatement
protected PreparedStatement createPreparedStatement(String sql,
int autogeneratedkeys)
throws SQLException
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql)
throws SQLException
- Creates a PreparedStatement for the given SQL. If possible, the
statement is fetched from the cache.
- Specified by:
prepareStatement in interface Connection- Overrides:
prepareStatement in class CoreConnection
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
- Creates a PreparedStatement for the given SQL, type and concurrency.
If possible, the statement is fetched from the cache.
- Specified by:
prepareStatement in interface Connection- Overrides:
prepareStatement in class CoreConnection
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
- Specified by:
prepareStatement in interface Connection- Overrides:
prepareStatement in class CoreConnection
- Throws:
SQLException
isClosed
public boolean isClosed()
throws SQLException
- Specified by:
isClosed in interface Connection- Overrides:
isClosed in class CoreConnection
- Throws:
SQLException
prepareCall
public CallableStatement prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
- Throws:
SQLException
createStatementWrapper
public Statement createStatementWrapper()
throws SQLException
- Throws:
SQLException
createStatement
public Statement createStatement()
throws SQLException
- Specified by:
createStatement in interface Connection- Overrides:
createStatement in class CoreConnection
- Throws:
SQLException
Copyright © 2011. All Rights Reserved.