public final class StatementCacheInteractor
extends java.lang.Object
This class was introduced to share code between the pre-JDBC 4 and the JDBC 4+ versions of the JDBC classes.
The pattern for the prepareX
methods is:
Modifier and Type | Field and Description |
---|---|
private JDBCStatementCache |
cache
Statement cache for the associated physical connection.
|
private boolean |
connCloseInProgress
Tells if this interactor is in the process of shutting down.
|
private java.util.ArrayList<LogicalStatementEntity> |
openLogicalStatements
List of open logical statements created by this cache interactor.
|
private ClientConnection |
physicalConnection
The underlying physical connection.
|
Constructor and Description |
---|
StatementCacheInteractor(JDBCStatementCache cache,
ClientConnection physicalConnection)
Creates a new JDBC statement cache interactor.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
closeOpenLogicalStatements()
Closes all open logical statements created by this cache interactor.
|
private java.sql.CallableStatement |
createLogicalCallableStatement(java.sql.CallableStatement cs,
StatementKey stmtKey)
Creates a logical callable statement.
|
private java.sql.PreparedStatement |
createLogicalPreparedStatement(java.sql.PreparedStatement ps,
StatementKey stmtKey)
Creates a logical prepared statement.
|
(package private) JDBCStatementCache |
getCache()
Returns the associated statement cache.
|
(package private) void |
markClosed(LogicalStatementEntity logicalStmt)
Designates the specified logical statement as closed.
|
(package private) java.sql.CallableStatement |
prepareCall(java.lang.String sql) |
(package private) java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
(package private) java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
(package private) java.sql.PreparedStatement |
prepareStatement(java.lang.String sql) |
(package private) java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys) |
(package private) java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
(package private) java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
private final JDBCStatementCache cache
private final ClientConnection physicalConnection
Note that it is the responsibility of the logical statement assoiciated with this cache interactor to ensure the interactor methods are not invoked if the logical statement has been closed.
private final java.util.ArrayList<LogicalStatementEntity> openLogicalStatements
private boolean connCloseInProgress
If this is true, it means that the logical connection is being closed.
StatementCacheInteractor(JDBCStatementCache cache, ClientConnection physicalConnection)
cache
- statement cachephysicalConnection
- associated physical connectionjava.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareStatement(String)
java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareStatement(String,int,int)
java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareStatement(String,int,int,int)
java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareStatement(String,int)
java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareCall(String)
java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareCall(String,int,int)
java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
java.sql.SQLException
Connection.prepareCall(String,int,int,int)
void closeOpenLogicalStatements() throws java.sql.SQLException
A cache interactor is bound to a single (caching) logical connection.
java.sql.SQLException
- if closing an open logical connection failsvoid markClosed(LogicalStatementEntity logicalStmt)
logicalStmt
- the logical statement being closedprivate java.sql.PreparedStatement createLogicalPreparedStatement(java.sql.PreparedStatement ps, StatementKey stmtKey) throws java.sql.SQLException
ps
- the underlying physical prepared statementstmtKey
- the statement key for the physical statementjava.sql.SQLException
- if creating a logical prepared statement failsprivate java.sql.CallableStatement createLogicalCallableStatement(java.sql.CallableStatement cs, StatementKey stmtKey) throws java.sql.SQLException
cs
- the underlying physical callable statementstmtKey
- the statement key for the physical statementjava.sql.SQLException
- if creating a logical callable statement failsJDBCStatementCache getCache()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.