com.pivotal.gemfirexd.internal.client.am

## Class StatementCacheInteractor

- java.lang.Object
- - com.pivotal.gemfirexd.internal.client.am.StatementCacheInteractor

    public final class StatementCacheInteractor
    extends Object

Utility class encapsulating the logic for interacting with the JDBC statement cache when creating new logical statements.

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:

1. Generate a key for the statement to create.
2. Consult cache to see if an existing statement can be used.
3. Create new statement on physical connection if necessary.
4. Return reference to existing or newly created statement.

### Method Summary

Methods
`void` `closeOpenLogicalStatements()` Closes all open logical statements created by this cache interactor.
`void` `markClosed(com.pivotal.gemfirexd.internal.client.am.LogicalStatementEntity logicalStmt)` Designates the specified logical statement as closed.
`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 resultSetType, int resultSetConcurrency)`
`PreparedStatement` `prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### prepareStatement

    public PreparedStatement prepareStatement(String sql)
                                       throws SQLException

Throws:
  `SQLException`
See Also:
  `Connection.prepareStatement(String)`

#### prepareStatement

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

Throws:
  `SQLException`
See Also:
  `Connection.prepareStatement(String,int,int)`

#### prepareStatement

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

Throws:
  `SQLException`
See Also:
  `Connection.prepareStatement(String,int,int,int)`

#### prepareStatement

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

Throws:
  `SQLException`
See Also:
  `Connection.prepareStatement(String,int)`

#### prepareCall

    public CallableStatement prepareCall(String sql)
                                  throws SQLException

Throws:
  `SQLException`
See Also:
  `Connection.prepareCall(String)`

#### prepareCall

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

Throws:
  `SQLException`
See Also:
  `Connection.prepareCall(String,int,int)`

#### prepareCall

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

Throws:
  `SQLException`
See Also:
  `Connection.prepareCall(String,int,int,int)`

#### closeOpenLogicalStatements

    public void closeOpenLogicalStatements()
                                    throws SQLException

Closes all open logical statements created by this cache interactor.

A cache interactor is bound to a single (caching) logical connection.

Throws:
  `SQLException` - if closing an open logical connection fails

#### markClosed

    public void markClosed(com.pivotal.gemfirexd.internal.client.am.LogicalStatementEntity logicalStmt)

Designates the specified logical statement as closed.

Parameters:
  `logicalStmt` - the logical statement being closed