java.lang.AutoCloseable
, java.sql.Connection
, java.sql.Wrapper
public class CachingLogicalConnection extends LogicalConnection
An instance of this class is what is passed out the the client. It uses a JDBC statement object cache to avoid re-preparing commonly used queries. The cache has scope of a physical connection, and is lost when the pooled connection is closed (which includes closing the physical connection).
StatementCacheInteractor
Modifier and Type | Field | Description |
---|---|---|
private StatementCacheInteractor |
cacheInteractor |
JDBC statement cache interactor used to prepare statements and calls.
|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
physicalConnection_
Constructor | Description |
---|---|
CachingLogicalConnection(ClientConnection physicalConnection,
ClientPooledConnection pooledConnection,
JDBCStatementCache stmtCache) |
Creates a new logical connection which caches prepared statements.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql) |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames) |
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
abort, checkForNullPhysicalConnection, clearWarnings, closeWithoutRecyclingToPool, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, finalize, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getRealMetaDataObject, getSchema, getServerVersion, getTransactionID, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, newLogicalDatabaseMetaData, notifyException, nullPhysicalConnection, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, unwrap
private StatementCacheInteractor cacheInteractor
public CachingLogicalConnection(ClientConnection physicalConnection, ClientPooledConnection pooledConnection, JDBCStatementCache stmtCache) throws SqlException
physicalConnection
- underlying physical database connectionpooledConnection
- associated pooled connectionstmtCache
- associated statement cacheSqlException
- if creating the logical connection failspublic void close() throws java.sql.SQLException
close
in interface java.lang.AutoCloseable
close
in interface java.sql.Connection
close
in class LogicalConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class LogicalConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class LogicalConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class LogicalConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class LogicalConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class LogicalConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class LogicalConnection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
prepareCall
in class LogicalConnection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
prepareCall
in class LogicalConnection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
prepareCall
in class LogicalConnection
java.sql.SQLException
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.