Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.jdbc
Class EmbedStatement  view EmbedStatement download EmbedStatement.java

java.lang.Object
  extended byorg.apache.derby.impl.jdbc.ConnectionChild
      extended byorg.apache.derby.impl.jdbc.EmbedStatement
All Implemented Interfaces:
java.sql.Statement
Direct Known Subclasses:
EmbedPreparedStatement

public class EmbedStatement
extends ConnectionChild
implements java.sql.Statement

EmbedStatement is a local JDBC statement.

Supports


Field Summary
protected  boolean active
           
private  java.sql.Connection applicationConnection
           
private  java.sql.ResultSet autoGeneratedKeysResultSet
           
protected  java.util.Vector batchStatements
           
protected static boolean CLOSE
           
private  int currentDynamicResultSet
           
protected  java.lang.String cursorName
           
private  EmbedResultSet[] dynamicResults
           
protected  org.apache.derby.jdbc.InternalDriver factory
          Factory for JDBC objects to be created.
private  int fetchDirection
           
private  int fetchSize
           
protected  boolean forMetaData
           
protected  org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc
           
protected  EmbedConnection localConn
           
(package private)  int MaxFieldSize
           
(package private)  int maxRows
           
protected static boolean NOCLOSE
           
private  org.apache.derby.iapi.sql.ParameterValueSet pvs
           
protected  java.sql.ResultSet results
           
protected  int resultSetConcurrency
           
protected  int resultSetHoldability
           
 int resultSetType
           
protected  java.lang.String SQLText
           
protected  int updateCount
           
private  java.sql.SQLWarning warnings
           
 
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
EmbedStatement(EmbedConnection connection, boolean forMetaData, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 
Method Summary
 void addBatch(java.lang.String sql)
          JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement.
 void cancel()
          Cancel can be used by one thread to cancel a statement that is being executed by another thread.
protected  void checkExecStatus()
          A heavier weight version of checkStatus() that ensures the application's Connection object is still open.
protected  void checkIfInMiddleOfBatch()
           
protected  void checkRequiresCallableStatement(org.apache.derby.iapi.sql.Activation activation)
          Check to see if a statement requires to be executed via a callable statement.
protected  void checkStatus()
           
 void clearBatch()
          JDBC 2.0 Make the set of commands in the current batch empty.
protected  void clearResultSets()
          Close and clear all result sets associated with this statement from the last execution.
 void clearWarnings()
          After this call getWarnings returns null until a new warning is reported for this Statement.
 void close()
          In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.
protected  void closeActions()
           
protected  void commitIfAutoCommit()
          Perform a commit if autocommit is enabled.
protected  void commitIfNeeded()
          Perform a commit if one is needed.
 boolean execute(java.lang.String sql)
          Execute a SQL statement that may return multiple results.
protected  boolean execute(java.lang.String sql, boolean executeQuery, boolean executeUpdate, int autoGeneratedKeys, int[] columnIndexes, java.lang.String[] columnNames)
           
 boolean execute(java.lang.String sql, int autoGeneratedKeys)
          JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.
 boolean execute(java.lang.String sql, int[] columnIndexes)
          JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
 boolean execute(java.lang.String sql, java.lang.String[] columnNames)
          JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
 int[] executeBatch()
          JDBC 2.0 Submit a batch of commands to the database for execution.
protected  boolean executeBatchElement(java.lang.Object batchElement)
          Execute a single element of the batch.
 java.sql.ResultSet executeQuery(java.lang.String sql)
          Execute a SQL statement that returns a single ResultSet.
protected  boolean executeStatement(org.apache.derby.iapi.sql.Activation a, boolean executeQuery, boolean executeUpdate)
          Execute the current statement.
 int executeUpdate(java.lang.String sql)
          Execute a SQL INSERT, UPDATE or DELETE statement.
 int executeUpdate(java.lang.String sql, int autoGeneratedKeys)
          JDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.
 int executeUpdate(java.lang.String sql, int[] columnIndexes)
          JDBC 3.0 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.
 int executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
          JDBC 3.0 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.
protected  java.util.Calendar getCal()
          Get and save a unique calendar object for this JDBC object.
 java.sql.Connection getConnection()
          JDBC 2.0 Return the Connection that produced the Statement.
protected  java.lang.Object getConnectionSynchronization()
          Return an object to be used for connection synchronization.
 org.apache.derby.iapi.services.context.ContextManager getContextManager()
           
 org.apache.derby.iapi.db.Database getDatabase()
           
protected  EmbedConnection getEmbedConnection()
          Return a reference to the EmbedConnection
 int getFetchDirection()
          JDBC 2.0 Determine the fetch direction.
 int getFetchSize()
          JDBC 2.0 Determine the default fetch size.
 java.sql.ResultSet getGeneratedKeys()
          JDBC 3.0 Retrieves any auto-generated keys created as a result of executing this Statement object.
 int getMaxFieldSize()
          The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns.
 int getMaxRows()
          The maxRows limit is the maximum number of rows that a ResultSet can contain.
 boolean getMoreResults()
          getMoreResults moves to a Statement's next result.
 boolean getMoreResults(int current)
          JDBC 3.0 Moves to this Statement obect's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object
 org.apache.derby.iapi.sql.ParameterValueSet getParameterValueSet()
           
 int getQueryTimeout()
          The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 java.sql.ResultSet getResultSet()
          getResultSet returns the current result as a ResultSet.
 int getResultSetConcurrency()
          JDBC 2.0 Determine the result set concurrency.
 int getResultSetHoldability()
          JDBC 3.0 Retrieves the result set holdability for ResultSet objects generated by this Statement object.
 int getResultSetType()
          JDBC 2.0 Determine the result set type.
 java.lang.String getSQLText()
           
 int getUpdateCount()
          getUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results -1 is returned.
 java.sql.SQLWarning getWarnings()
          The first warning reported by calls on this Statement is returned.
protected  void getWarnings(java.sql.SQLWarning sw)
           
protected  java.sql.SQLException handleException(java.lang.Throwable t)
          Handle any exception.
protected  java.sql.SQLException handleException(java.lang.Throwable t, boolean close)
          Handle any exception.
protected  void needCommit()
          If Autocommit is on, note that a commit is needed.
protected  java.sql.SQLException newSQLException(java.lang.String messageId)
           
protected  java.sql.SQLException newSQLException(java.lang.String messageId, java.lang.Object arg1)
           
protected  java.sql.SQLException newSQLException(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
           
private  boolean processDynamicResults(java.sql.ResultSet[][] holder, int maxDynamicResultSets)
           
protected  void restoreContextStack()
          Setup the context stack (a.k.a.
(package private)  void resultSetClosing(EmbedResultSet closingLRS)
          Callback on the statement when one of its result sets is closed.
 void setCursorName(java.lang.String name)
          setCursorName defines the SQL cursor name that will be used by subsequent Statement execute methods.
 void setEscapeProcessing(boolean enable)
          If escape scanning is on (the default) the driver will do escape substitution before sending the SQL to the database.
 void setFetchDirection(int direction)
          JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed.
 void setFetchSize(int rows)
          JDBC 2.0 Give the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.
 void setMaxFieldSize(int max)
          The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields.
 void setMaxRows(int max)
          The maxRows limit is set to limit the number of rows that any ResultSet can contain.
 void setQueryTimeout(int seconds)
          The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
protected  void setupContextStack()
          Setup the context stack (a.k.a.
 void transferBatch(EmbedStatement other)
          Transfer my batch of Statements to a newly created Statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationConnection

private final java.sql.Connection applicationConnection

updateCount

protected int updateCount

results

protected java.sql.ResultSet results

autoGeneratedKeysResultSet

private java.sql.ResultSet autoGeneratedKeysResultSet

cursorName

protected java.lang.String cursorName

forMetaData

protected final boolean forMetaData

resultSetType

public final int resultSetType

resultSetConcurrency

protected final int resultSetConcurrency

resultSetHoldability

protected final int resultSetHoldability

lcc

protected final org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc

warnings

private java.sql.SQLWarning warnings

SQLText

protected java.lang.String SQLText

fetchSize

private int fetchSize

fetchDirection

private int fetchDirection

MaxFieldSize

int MaxFieldSize

active

protected boolean active

batchStatements

protected java.util.Vector batchStatements

maxRows

int maxRows

pvs

private org.apache.derby.iapi.sql.ParameterValueSet pvs

dynamicResults

private EmbedResultSet[] dynamicResults

currentDynamicResultSet

private int currentDynamicResultSet

CLOSE

protected static final boolean CLOSE
See Also:
Constant Field Values

NOCLOSE

protected static final boolean NOCLOSE
See Also:
Constant Field Values

localConn

protected EmbedConnection localConn

factory

protected final org.apache.derby.jdbc.InternalDriver factory
Factory for JDBC objects to be created.

Constructor Detail

EmbedStatement

public EmbedStatement(EmbedConnection connection,
                      boolean forMetaData,
                      int resultSetType,
                      int resultSetConcurrency,
                      int resultSetHoldability)
Method Detail

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql)
                                throws java.sql.SQLException
Execute a SQL statement that returns a single ResultSet.

Specified by:
executeQuery in interface java.sql.Statement

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
Execute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.

Specified by:
executeUpdate in interface java.sql.Statement

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int autoGeneratedKeys)
                  throws java.sql.SQLException
JDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.

Specified by:
executeUpdate in interface java.sql.Statement

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int[] columnIndexes)
                  throws java.sql.SQLException
JDBC 3.0 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. The driver will ignore the array if the SQL statement is not an INSERT statement

Specified by:
executeUpdate in interface java.sql.Statement

executeUpdate

public int executeUpdate(java.lang.String sql,
                         java.lang.String[] columnNames)
                  throws java.sql.SQLException
JDBC 3.0 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. The driver will ignore the array if the SQL statement is not an INSERT statement

Specified by:
executeUpdate in interface java.sql.Statement

checkIfInMiddleOfBatch

protected final void checkIfInMiddleOfBatch()
                                     throws java.sql.SQLException

close

public final void close()
                 throws java.sql.SQLException
In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.

Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed its current ResultSet, if one exists, is also closed.

Specified by:
close in interface java.sql.Statement

closeActions

protected void closeActions()
                     throws java.sql.SQLException

getMaxFieldSize

public int getMaxFieldSize()
                    throws java.sql.SQLException
The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.

Specified by:
getMaxFieldSize in interface java.sql.Statement

setMaxFieldSize

public void setMaxFieldSize(int max)
                     throws java.sql.SQLException
The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. If the limit is exceeded, the excess data is silently discarded.

Specified by:
setMaxFieldSize in interface java.sql.Statement

getMaxRows

public int getMaxRows()
               throws java.sql.SQLException
The maxRows limit is the maximum number of rows that a ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.

Specified by:
getMaxRows in interface java.sql.Statement

setMaxRows

public void setMaxRows(int max)
                throws java.sql.SQLException
The maxRows limit is set to limit the number of rows that any ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.

Specified by:
setMaxRows in interface java.sql.Statement

setEscapeProcessing

public void setEscapeProcessing(boolean enable)
                         throws java.sql.SQLException
If escape scanning is on (the default) the driver will do escape substitution before sending the SQL to the database.

Specified by:
setEscapeProcessing in interface java.sql.Statement

getQueryTimeout

public int getQueryTimeout()
                    throws java.sql.SQLException
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded a SQLException is thrown.

Specified by:
getQueryTimeout in interface java.sql.Statement

setQueryTimeout

public void setQueryTimeout(int seconds)
                     throws java.sql.SQLException
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded a SQLException is thrown.

Specified by:
setQueryTimeout in interface java.sql.Statement

cancel

public void cancel()
            throws java.sql.SQLException
Cancel can be used by one thread to cancel a statement that is being executed by another thread.

Specified by:
cancel in interface java.sql.Statement

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
The first warning reported by calls on this Statement is returned. A Statment's execute methods clear its SQLWarning chain. Subsequent Statement warnings will be chained to this SQLWarning.

The warning chain is automatically cleared each time a statement is (re)executed.

Note: If you are processing a ResultSet then any warnings associated with ResultSet reads will be chained on the ResultSet object.

Specified by:
getWarnings in interface java.sql.Statement

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
After this call getWarnings returns null until a new warning is reported for this Statement.

Specified by:
clearWarnings in interface java.sql.Statement

setCursorName

public void setCursorName(java.lang.String name)
                   throws java.sql.SQLException
setCursorName defines the SQL cursor name that will be used by subsequent Statement execute methods. This name can then be used in SQL positioned update/delete statements to identify the current row in the ResultSet generated by this statement. If the database doesn't support positioned update/delete, this method is a noop.

Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a Connection.

Specified by:
setCursorName in interface java.sql.Statement

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
Execute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Specified by:
execute in interface java.sql.Statement

execute

protected boolean execute(java.lang.String sql,
                          boolean executeQuery,
                          boolean executeUpdate,
                          int autoGeneratedKeys,
                          int[] columnIndexes,
                          java.lang.String[] columnNames)
                   throws java.sql.SQLException

execute

public boolean execute(java.lang.String sql,
                       int autoGeneratedKeys)
                throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. The driver will ignore this signal if the SQL statement is not an INSERT statement.

Specified by:
execute in interface java.sql.Statement

execute

public boolean execute(java.lang.String sql,
                       int[] columnIndexes)
                throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement, which may return multiple results, 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 given SQL statement is not an INSERT statement.

Specified by:
execute in interface java.sql.Statement

execute

public boolean execute(java.lang.String sql,
                       java.lang.String[] columnNames)
                throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement, which may return multiple results, 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 given SQL statement is not an INSERT statement.

Specified by:
execute in interface java.sql.Statement

getResultSet

public final java.sql.ResultSet getResultSet()
                                      throws java.sql.SQLException
getResultSet returns the current result as a ResultSet. It should only be called once per result.

Specified by:
getResultSet in interface java.sql.Statement

getUpdateCount

public final int getUpdateCount()
                         throws java.sql.SQLException
getUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results -1 is returned. It should only be called once per result.

The only way to tell for sure that the result is an update count is to first test to see if it is a ResultSet. If it is not a ResultSet it is either an update count or there are no more results.

Specified by:
getUpdateCount in interface java.sql.Statement

getMoreResults

public final boolean getMoreResults()
                             throws java.sql.SQLException
getMoreResults moves to a Statement's next result. It returns true if this result is a ResultSet. getMoreResults also implicitly closes any current ResultSet obtained with getResultSet. There are no more results when (!getMoreResults() && (getUpdateCount() == -1)

Specified by:
getMoreResults in interface java.sql.Statement

getResultSetType

public final int getResultSetType()
                           throws java.sql.SQLException
JDBC 2.0 Determine the result set type.

Specified by:
getResultSetType in interface java.sql.Statement

setFetchDirection

public void setFetchDirection(int direction)
                       throws java.sql.SQLException
JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. The default value is ResultSet.FETCH_FORWARD.

Specified by:
setFetchDirection in interface java.sql.Statement

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
JDBC 2.0 Determine the fetch direction.

Specified by:
getFetchDirection in interface java.sql.Statement

setFetchSize

public void setFetchSize(int rows)
                  throws java.sql.SQLException
JDBC 2.0 Give the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified only affects result sets created using this statement. If the value specified is zero, then the hint is ignored. The default value is zero.

Specified by:
setFetchSize in interface java.sql.Statement

getFetchSize

public int getFetchSize()
                 throws java.sql.SQLException
JDBC 2.0 Determine the default fetch size.

Specified by:
getFetchSize in interface java.sql.Statement

getResultSetConcurrency

public int getResultSetConcurrency()
                            throws java.sql.SQLException
JDBC 2.0 Determine the result set concurrency.

Specified by:
getResultSetConcurrency in interface java.sql.Statement

getResultSetHoldability

public int getResultSetHoldability()
                            throws java.sql.SQLException
JDBC 3.0 Retrieves the result set holdability for ResultSet objects generated by this Statement object.

Specified by:
getResultSetHoldability in interface java.sql.Statement

addBatch

public void addBatch(java.lang.String sql)
              throws java.sql.SQLException
JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. This method is optional.

Specified by:
addBatch in interface java.sql.Statement

clearBatch

public final void clearBatch()
                      throws java.sql.SQLException
JDBC 2.0 Make the set of commands in the current batch empty. This method is optional.

Specified by:
clearBatch in interface java.sql.Statement

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
JDBC 2.0 Submit a batch of commands to the database for execution. This method is optional. Moving jdbc2.0 batch related code in this class because callableStatement in jdbc 20 needs this code too and it doesn't derive from prepared statement in jdbc 20 in our implementation. BatchUpdateException is the only new class from jdbc 20 which is being referenced here and in order to avoid any jdk11x problems, using reflection code to make an instance of that class.

Specified by:
executeBatch in interface java.sql.Statement

executeBatchElement

protected boolean executeBatchElement(java.lang.Object batchElement)
                               throws java.sql.SQLException,
                                      org.apache.derby.iapi.error.StandardException
Execute a single element of the batch. Overridden by EmbedPreparedStatement


getConnection

public final java.sql.Connection getConnection()
                                        throws java.sql.SQLException
JDBC 2.0 Return the Connection that produced the Statement.

Specified by:
getConnection in interface java.sql.Statement

getMoreResults

public final boolean getMoreResults(int current)
                             throws java.sql.SQLException
JDBC 3.0 Moves to this Statement obect's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object

Specified by:
getMoreResults in interface java.sql.Statement

getGeneratedKeys

public final java.sql.ResultSet getGeneratedKeys()
                                          throws java.sql.SQLException
JDBC 3.0 Retrieves any auto-generated keys created as a result of executing this Statement object. If this Statement is a non-insert statement, a null ResultSet object is returned.

Specified by:
getGeneratedKeys in interface java.sql.Statement

executeStatement

protected boolean executeStatement(org.apache.derby.iapi.sql.Activation a,
                                   boolean executeQuery,
                                   boolean executeUpdate)
                            throws java.sql.SQLException
Execute the current statement.


getWarnings

protected void getWarnings(java.sql.SQLWarning sw)

getSQLText

public java.lang.String getSQLText()

getParameterValueSet

public org.apache.derby.iapi.sql.ParameterValueSet getParameterValueSet()

checkStatus

protected final void checkStatus()
                          throws java.sql.SQLException

checkExecStatus

protected final void checkExecStatus()
                              throws java.sql.SQLException
A heavier weight version of checkStatus() that ensures the application's Connection object is still open. This is to stop errors or unexpected behaviour when a [Prepared]Statement object is used after the application has been closed. In particular to ensure that a Statement obtained from a PooledConnection cannot be used after the application has closed its connection (as the underlying Connection is still active). To avoid this heavier weight check on every method of [Prepared]Statement it is only used on those methods that would end up using the database's connection to read or modify data. E.g. execute*(), but not setXXX, etc.


clearResultSets

protected void clearResultSets()
                        throws java.sql.SQLException
Close and clear all result sets associated with this statement from the last execution.


checkRequiresCallableStatement

protected void checkRequiresCallableStatement(org.apache.derby.iapi.sql.Activation activation)
                                       throws java.sql.SQLException
Check to see if a statement requires to be executed via a callable statement.


transferBatch

public void transferBatch(EmbedStatement other)
                   throws java.sql.SQLException
Transfer my batch of Statements to a newly created Statement.


processDynamicResults

private boolean processDynamicResults(java.sql.ResultSet[][] holder,
                                      int maxDynamicResultSets)
                               throws java.sql.SQLException

resultSetClosing

void resultSetClosing(EmbedResultSet closingLRS)
                throws java.sql.SQLException
Callback on the statement when one of its result sets is closed. This allows the statement to control when it completes and hence when it commits in auto commit mode. Must have connection synchronization and setupContextStack(), this is required for the call to commitIfNeeded().


getEmbedConnection

protected final EmbedConnection getEmbedConnection()
Return a reference to the EmbedConnection


getConnectionSynchronization

protected final java.lang.Object getConnectionSynchronization()
Return an object to be used for connection synchronization.


handleException

protected final java.sql.SQLException handleException(java.lang.Throwable t)
                                               throws java.sql.SQLException
Handle any exception.


handleException

protected final java.sql.SQLException handleException(java.lang.Throwable t,
                                                      boolean close)
                                               throws java.sql.SQLException
Handle any exception.


needCommit

protected final void needCommit()
If Autocommit is on, note that a commit is needed.


commitIfNeeded

protected final void commitIfNeeded()
                             throws java.sql.SQLException
Perform a commit if one is needed.


commitIfAutoCommit

protected final void commitIfAutoCommit()
                                 throws java.sql.SQLException
Perform a commit if autocommit is enabled.


setupContextStack

protected final void setupContextStack()
                                throws java.sql.SQLException
Setup the context stack (a.k.a. context manager) for this connection.


restoreContextStack

protected final void restoreContextStack()
                                  throws java.sql.SQLException
Setup the context stack (a.k.a. context manager) for this connection.


getContextManager

public org.apache.derby.iapi.services.context.ContextManager getContextManager()

getDatabase

public org.apache.derby.iapi.db.Database getDatabase()

getCal

protected java.util.Calendar getCal()
Get and save a unique calendar object for this JDBC object. No need to synchronize because multiple threads should not be using a single JDBC object. Even if they do there is only a small window where each would get its own Calendar for a single call.


newSQLException

protected java.sql.SQLException newSQLException(java.lang.String messageId)

newSQLException

protected java.sql.SQLException newSQLException(java.lang.String messageId,
                                                java.lang.Object arg1)

newSQLException

protected java.sql.SQLException newSQLException(java.lang.String messageId,
                                                java.lang.Object arg1,
                                                java.lang.Object arg2)