org.apache.derby.client.am
Class CachingLogicalConnection

java.lang.Object
  extended by org.apache.derby.client.am.LogicalConnection
      extended by org.apache.derby.client.am.CachingLogicalConnection
All Implemented Interfaces:
java.sql.Connection, java.sql.Wrapper

public class CachingLogicalConnection
extends LogicalConnection

A logical connection used in a connection pool with capabilities for caching prepared statements.

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).

See Also:
StatementCacheInteractor

Field Summary
private  StatementCacheInteractor cacheInteractor
          JDBC statement cache interactor used to prepare statements and calls.
 
Fields inherited from class org.apache.derby.client.am.LogicalConnection
physicalConnection_
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
CachingLogicalConnection(Connection physicalConnection, ClientPooledConnection pooledConnection, JDBCStatementCache stmtCache)
          Creates a new logical connection which caches prepared statements.
 
Method Summary
 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)
           
 
Methods inherited from class org.apache.derby.client.am.LogicalConnection
checkForNullPhysicalConnection, clearWarnings, closeWithoutRecyclingToPool, commit, createStatement, createStatement, createStatement, finalize, getAutoCommit, getCatalog, getHoldability, getMetaData, getRealMetaDataObject, getServerVersion, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, newLogicalDatabaseMetaData, notifyException, nullPhysicalConnection, preparePositionedUpdateStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, 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
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

cacheInteractor

private StatementCacheInteractor cacheInteractor
JDBC statement cache interactor used to prepare statements and calls.

Constructor Detail

CachingLogicalConnection

public CachingLogicalConnection(Connection physicalConnection,
                                ClientPooledConnection pooledConnection,
                                JDBCStatementCache stmtCache)
                         throws SqlException
Creates a new logical connection which caches prepared statements.

Parameters:
physicalConnection - underlying physical database connection
pooledConnection - associated pooled connection
stmtCache - associated statement cache
Throws:
SqlException - if creating the logical connection fails
Method Detail

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Connection
Overrides:
close in class LogicalConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class LogicalConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class LogicalConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency,
                                                   int resultSetHoldability)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class LogicalConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int autoGeneratedKeys)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class LogicalConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int[] columnIndexes)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class LogicalConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   java.lang.String[] columnNames)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class LogicalConnection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Overrides:
prepareCall in class LogicalConnection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Overrides:
prepareCall in class LogicalConnection
Throws:
java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency,
                                              int resultSetHoldability)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Overrides:
prepareCall in class LogicalConnection
Throws:
java.sql.SQLException

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.