|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.client.am.LogicalStatementEntity
abstract class LogicalStatementEntity
Common class interacting with the JDBC statement cache for logical prepared statements and logical callable statements.
Note that getPhysPs()
and getPhysCs()
takes care of checking if
the logical statement has been closed. The physical statement will take care
of validating itself.
Beside from the above, special treatment of logical entities happens on close. This is the point where cache interaction takes place, and also where the appropriate methods are called on the physical statement to perform the necessary clean up for later reuse.
A note regarding the thread safety of this class, is that access to
physicalPs
and physicalCs
is guarded by the instance of this
class, but it is assumed that operation on/within the physical statement is
synchronized in the physical statement itself .
Field Summary | |
---|---|
private JDBCStatementCache |
cache
Cache for physical statements. |
private boolean |
hasCallableStmt
Tells if we're holding a callable statement or not. |
private StatementCacheInteractor |
owner
The owner of this logical entity. |
private java.sql.CallableStatement |
physicalCs
Assoicated physical callable statement, if any. |
private java.sql.PreparedStatement |
physicalPs
Associated physical prepared statement. |
private StatementKey |
stmtKey
The key for the associated statement. |
Fields inherited from interface java.sql.Statement |
---|
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
Constructor Summary | |
---|---|
protected |
LogicalStatementEntity(java.sql.PreparedStatement physicalPs,
StatementKey stmtKey,
StatementCacheInteractor cacheInteractor)
Create a logical entity for a PreparedStatement . |
Method Summary | |
---|---|
void |
close()
Close the logical statement. |
(package private) java.sql.CallableStatement |
getPhysCs()
Returns the associated physical callable statement. |
(package private) java.sql.PreparedStatement |
getPhysPs()
Returns the associated physical prepared statement. |
(package private) boolean |
isLogicalEntityClosed()
Tells if the logical entity is closed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.sql.Statement |
---|
addBatch, cancel, clearBatch, clearWarnings, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout |
Methods inherited from interface java.sql.Wrapper |
---|
isWrapperFor, unwrap |
Field Detail |
---|
private final boolean hasCallableStmt
Used for sanity checking.
private java.sql.PreparedStatement physicalPs
If this is null
, the logical entity is closed.
private java.sql.CallableStatement physicalCs
This is a convenience reference, to avoid having to cast on every
invokation of getPhysCs()
if the logical entity represents a
callable statement.
private StatementCacheInteractor owner
private final StatementKey stmtKey
private final JDBCStatementCache cache
Constructor Detail |
---|
protected LogicalStatementEntity(java.sql.PreparedStatement physicalPs, StatementKey stmtKey, StatementCacheInteractor cacheInteractor)
PreparedStatement
.
physicalPs
- a physical PreparedStatement
stmtKey
- cache key for the physical statementcacheInteractor
- creating statement cache interactor
java.lang.IllegalArgumentException
- if cache
is null
Method Detail |
---|
java.sql.PreparedStatement getPhysPs() throws java.sql.SQLException
java.sql.SQLException
- if the logical statement has been closedjava.sql.CallableStatement getPhysCs() throws java.sql.SQLException
java.sql.SQLException
- if the logical statement has been closedpublic void close() throws java.sql.SQLException
close
in interface java.sql.Statement
java.sql.SQLException
- if closing the statement failsboolean isLogicalEntityClosed()
If this method is used to avoid the possibility of raising an exception because the logical statement has been closed and then invoke a method on the physical statement, one must synchronize on this instance in the calling code.
true
if closed, false
if open.
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |