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 .
| Modifier and Type | Field and Description |
|---|---|
| private final JDBCStatementCache | cache
Cache for physical statements. |
| private final boolean | hasCallableStmt
Tells if we're holding a callable statement or not. |
| private StatementCacheInteractor | owner
The owner of this logical entity. |
| private CallableStatement | physicalCs
Associated physical callable statement, if any. |
| private PreparedStatement | physicalPs
Associated physical prepared statement. |
| private final StatementKey | stmtKey
The key for the associated statement. |
| Access | Constructor and Description |
|---|---|
| protected | LogicalStatementEntity(PreparedStatement
a physical physicalPs, StatementKey java.cache key for the physical statement stmtKey, StatementCacheInteractor creating statement cache interactor cacheInteractor)Create a logical entity for a |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public void | closeOnCompletion()
Implements java. Statement will be closed when all its
dependent result sets are closed.
|
| public long[] | executeLargeBatch()
Overrides default java. |
| public long | executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement,
such as sql)INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.Overrides default java. INSERT,
UPDATE, or DELETE statement or an
SQL statement that returns nothing, such as an SQL DDL statement.
|
| public long | executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement,
such as sql, int INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.a flag indicating whether auto-generated keys
should be made available for retrieval;
one of the following constants:
autoGeneratedKeys)Statement.RETURN_GENERATED_KEYS
Statement.NO_GENERATED_KEYSOverrides default java. Statement object
should be made available for retrieval.
|
| public long | executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement,
such as sql, int[] INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.an array of column indexes indicating the columns
that should be returned from the inserted row columnIndexes)Overrides default java. |
| public long | executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement,
such as sql, String[] INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.an array of the names of the columns that should be
returned from the inserted row columnNames)Overrides default java. |
| public long | getLargeMaxRows()
Overrides default java. ResultSet object produced by this
Statement object can contain.
|
| public long | getLargeUpdateCount()
Overrides default java. ResultSet object or there are no more results, -1
is returned.
|
| pack-priv synchronized CallableStatement | |
| pack-priv synchronized PreparedStatement | |
| private synchronized Statement | |
| public boolean | isCloseOnCompletion()
Implements java. Statement will be
closed when all its dependent result sets are closed.
|
| pack-priv synchronized boolean | Returns: true if closed, false if open.Tells if the logical entity is closed. |
| public boolean | Returns: true if this instance implements iface, or
false otherwisea class defining an interface iface)Implements java. iface.
|
| public void | setLargeMaxRows(long
the new max rows limit; zero means there is no limit maxRows)Overrides default java. ResultSet object generated by this Statement
object can contain to the given number.
|
| public <T> T | Returns: an object that implements the interfacea class defining an interface iface)Implements java. |
| cache | back to summary |
|---|---|
| private final JDBCStatementCache cache Cache for physical statements. | |
| hasCallableStmt | back to summary |
|---|---|
| private final boolean hasCallableStmt Tells if we're holding a callable statement or not. Used for sanity checking. | |
| owner | back to summary |
|---|---|
| private StatementCacheInteractor owner The owner of this logical entity. | |
| physicalCs | back to summary |
|---|---|
| private CallableStatement physicalCs Associated physical callable statement, if any.
This is a convenience reference, to avoid having to cast on every
invocation of | |
| physicalPs | back to summary |
|---|---|
| private PreparedStatement physicalPs Associated physical prepared statement.
If this is | |
| stmtKey | back to summary |
|---|---|
| private final StatementKey stmtKey The key for the associated statement. | |
| LogicalStatementEntity | back to summary |
|---|---|
| protected LogicalStatementEntity(PreparedStatement physicalPs, StatementKey stmtKey, StatementCacheInteractor cacheInteractor) Create a logical entity for a
| |
| close | back to summary |
|---|---|
| public synchronized void close() throws SQLException Implements java. Close the logical statement.
| |
| closeOnCompletion | back to summary |
|---|---|
| public void closeOnCompletion() throws SQLException Implements java. Doc from java. Specifies that this Note Multiple calls to
| |
| executeLargeBatch | back to summary |
|---|---|
| public long[] executeLargeBatch() throws SQLException Overrides default java. Doc from java. Submits a batch of commands to the database for execution and
if all commands execute successfully, returns an array of update counts.
The
This method should be used when the returned row count may exceed
The default implementation will throw
| |
| executeLargeUpdate | back to summary |
|---|---|
| public long executeLargeUpdate(String sql) throws SQLException Overrides default java. Doc from java. Executes the given SQL statement, which may be an
This method should be used when the returned row count may exceed
Note This method cannot be called on a
The default implementation will throw
| |
| executeLargeUpdate | back to summary |
|---|---|
| public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException Overrides default java. Doc from java. Executes the given SQL statement and signals the driver with the
given flag about whether the
auto-generated keys produced by this
This method should be used when the returned row count may exceed
Note This method cannot be called on a
The default implementation will throw
| |
| executeLargeUpdate | back to summary |
|---|---|
| public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException Overrides default java. Doc from java. Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval. This array contains the indexes of the columns in the
target table that contain the auto-generated keys that should be made
available. The driver will ignore the array if the SQL statement
is not an
This method should be used when the returned row count may exceed
Note This method cannot be called on a
The default implementation will throw
| |
| executeLargeUpdate | back to summary |
|---|---|
| public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException Overrides default java. Doc from java. Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval. This array contains the names of the columns in the
target table that contain the auto-generated keys that should be made
available. The driver will ignore the array if the SQL statement
is not an
This method should be used when the returned row count may exceed
Note This method cannot be called on a
The default implementation will throw
| |
| getLargeMaxRows | back to summary |
|---|---|
| public long getLargeMaxRows() throws SQLException Overrides default java. Doc from java. Retrieves the maximum number of rows that a
This method should be used when the returned row limit may exceed
The default implementation will return
| |
| getLargeUpdateCount | back to summary |
|---|---|
| public long getLargeUpdateCount() throws SQLException Overrides default java. Doc from java. Retrieves the current result as an update count; if the result
is a
This method should be used when the returned row count may exceed
The default implementation will throw
| |
| getPhysCs | back to summary |
|---|---|
| pack-priv synchronized CallableStatement getPhysCs() throws SQLException Returns the associated physical callable statement.
| |
| getPhysPs | back to summary |
|---|---|
| pack-priv synchronized PreparedStatement getPhysPs() throws SQLException Returns the associated physical prepared statement.
| |
| getPhysStmt | back to summary |
|---|---|
| private synchronized Statement getPhysStmt() throws SQLException Returns the associated physical statement.
| |
| isCloseOnCompletion | back to summary |
|---|---|
| public boolean isCloseOnCompletion() throws SQLException Implements java. Doc from java. Returns a value indicating whether this
| |
| isLogicalEntityClosed | back to summary |
|---|---|
| pack-priv synchronized boolean isLogicalEntityClosed() Tells if the logical entity is closed. 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.
| |
| isWrapperFor | back to summary |
|---|---|
| public boolean isWrapperFor(Class<?> iface) throws SQLException Implements java. Check whether this instance wraps an object that implements the interface
specified by
| |
| setLargeMaxRows | back to summary |
|---|---|
| public void setLargeMaxRows(long maxRows) throws SQLException Overrides default java. Doc from java. Sets the limit for the maximum number of rows that any
This method should be used when the row limit may exceed
The default implementation will throw
| |
| unwrap | back to summary |
|---|---|
| public <T> T unwrap(Class<T> iface) throws SQLException Implements java. Returns an instance of the specified interface if this instance is a wrapper for the interface.
| |