com.pivotal.gemfirexd.internal.client.am

## Class CachingLogicalConnection

- java.lang.Object
- - com.pivotal.gemfirexd.internal.client.am.LogicalConnection
  - - com.pivotal.gemfirexd.internal.client.am.CachingLogicalConnection

All Implemented Interfaces:
  AutoCloseable, Connection, Wrapper

    public abstract 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

### Fields inherited from class com.pivotal.gemfirexd.internal.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

Constructors
Constructor and Description
`CachingLogicalConnection(Connection physicalConnection, ClientPooledConnection pooledConnection, JDBCStatementCache stmtCache)` Creates a new logical connection which caches prepared statements.

### Method Summary

Methods
`void` `close()`
`CallableStatement` `prepareCall(String sql)`
`CallableStatement` `prepareCall(String sql, int resultSetType, int resultSetConcurrency)`
`CallableStatement` `prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
`PreparedStatement` `prepareStatement(String sql)`
`PreparedStatement` `prepareStatement(String sql, int autoGeneratedKeys)`
`PreparedStatement` `prepareStatement(String sql, int[] columnIndexes)`
`PreparedStatement` `prepareStatement(String sql, int resultSetType, int resultSetConcurrency)`
`PreparedStatement` `prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
`PreparedStatement` `prepareStatement(String sql, String[] columnNames)`

### Methods inherited from class com.pivotal.gemfirexd.internal.client.am.LogicalConnection

`checkForNullPhysicalConnection, clearWarnings, closeWithoutRecyclingToPool, commit, createStatement, createStatement, createStatement, finalize, getAutoCommit, getCatalog, getHoldability, getMetaData, getServerVersion, getTransactionID, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, 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

`abort, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, getClientInfo, getClientInfo, getNetworkTimeout, getSchema, isValid, setClientInfo, setClientInfo, setNetworkTimeout, setSchema`

### Methods inherited from interface java.sql.Wrapper

`isWrapperFor, unwrap`

### 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 SQLException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Connection`
Overrides:
  `close` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareStatement

    public PreparedStatement prepareStatement(String sql)
                                       throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Overrides:
  `prepareStatement` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareStatement

    public PreparedStatement prepareStatement(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency)
                                       throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Overrides:
  `prepareStatement` in class `LogicalConnection`
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 `LogicalConnection`
Throws:
  `SQLException`

#### prepareStatement

    public PreparedStatement prepareStatement(String sql,
                                     int autoGeneratedKeys)
                                       throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Overrides:
  `prepareStatement` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareStatement

    public PreparedStatement prepareStatement(String sql,
                                     int[] columnIndexes)
                                       throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Overrides:
  `prepareStatement` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareStatement

    public PreparedStatement prepareStatement(String sql,
                                     String[] columnNames)
                                       throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Overrides:
  `prepareStatement` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareCall

    public CallableStatement prepareCall(String sql)
                                  throws SQLException

Specified by:
  `prepareCall` in interface `Connection`
Overrides:
  `prepareCall` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareCall

    public CallableStatement prepareCall(String sql,
                                int resultSetType,
                                int resultSetConcurrency)
                                  throws SQLException

Specified by:
  `prepareCall` in interface `Connection`
Overrides:
  `prepareCall` in class `LogicalConnection`
Throws:
  `SQLException`

#### prepareCall

    public CallableStatement prepareCall(String sql,
                                int resultSetType,
                                int resultSetConcurrency,
                                int resultSetHoldability)
                                  throws SQLException

Specified by:
  `prepareCall` in interface `Connection`
Overrides:
  `prepareCall` in class `LogicalConnection`
Throws:
  `SQLException`