org.apache.derby.iapi.sql.conn
Interface LanguageConnectionContext

All Superinterfaces:
Context
All Known Implementing Classes:
GenericLanguageConnectionContext

public interface LanguageConnectionContext
extends Context

LanguageConnectionContext keeps the result sets, and activations in use by the current connection.

More stable items, like other factories, are accessible through the LanguageConnectionFactory or the LanguageFactory.

See Also:
LanguageConnectionFactory, LanguageFactory

Field Summary
static int ANSI_CASING
           
static int ANTI_ANSI_CASING
           
static java.lang.String CONTEXT_ID
          this is the ID we expect these contexts to be stored into a context manager under.
static java.lang.String dbnameStr
           
static java.lang.String drdaStr
           
static java.lang.String lccStr
           
static int MULTI_TRANSACTION_LOCK
           
static int NO_SCHEMAS
           
static int OUTERMOST_STATEMENT
           
static int SINGLE_TRANSACTION_LOCK
           
static int SQL92_SCHEMAS
           
static int UNKNOWN_CASING
           
static int USER_NAME_SCHEMA
           
static java.lang.String xidStr
           
 
Method Summary
 void addActivation(Activation a)
          Add the activation to those known about by this connection.
 void addDeclaredGlobalTempTable(TableDescriptor td)
          Add the declared global temporary table to the list of temporary tables known by this connection.
 boolean anyoneBlocked()
          Returns true if any transaction is blocked (even if not by this one)
 void appendOptimizerTraceOutput(java.lang.String output)
          Append the latest output to the optimizer trace output.
 void autoincrementCreateCounter(java.lang.String s, java.lang.String t, java.lang.String c, java.lang.Long initialValue, long increment, int position)
          Create an autoincrement counter to be used on behalf of a SQL-J statement.
 void autoincrementFlushCache(UUID tableUUID)
          Flush the cache of autoincrement values being kept by the lcc.
 void beginNestedTransaction(boolean readOnly)
          Begin a nested transaction.
 boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
          Check if there are any global temporary tables declared for this connection.
 void commitNestedTransaction()
          commit a nested transaction.
 java.lang.String convertIdentifierCase(java.lang.String id)
          Convert an identifier to the proper case for this connection.
 void copyHashtableToAIHT(java.util.Hashtable from)
          copy a hashtable of autoincrement key value pairs into the cache of ai values stored in the language connection context.
 boolean dataDictionaryInWriteMode()
          Return true if the data dictionary is in write mode (that is, this context was informed that is is in write mode by the method call setDataDictionaryWriteMode().
 int decrementBindCount()
          Decrement the DataDictionary bind count.
 void dropAllDeclaredGlobalTempTables()
          Drop all the declared global temporary tables associated with this connection.
 boolean dropDeclaredGlobalTempTable(java.lang.String tableName)
          Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.
 AccessFactory getAccessFactory()
          Get the AccessFactory cached in this LanguageConnectionContext
 int getActivationCount()
          Return the number of activation known for this connection.
 java.lang.String getAuthorizationId()
          Get the Authorization Id
 Authorizer getAuthorizer()
          Get an Authorizer for this connection.
 boolean getAutoincrementUpdate()
          Returns the current value of autoincrementUpdate.
 int getBindCount()
          Get the DataDictionary bind count.
 int getCurrentIsolationLevel()
          Get the current isolation level.
 java.lang.String getCurrentIsolationLevelStr()
          Get the current isolation level in DB2 format.
 java.lang.String getCurrentSchemaName()
          Get the current schema name
 Database getDatabase()
          Returns the Database of this connection.
 DataDictionary getDataDictionary()
          Get the data dictionary
 DataValueFactory getDataValueFactory()
          Get the data value factory to use with this language connection context.
 java.lang.String getDbname()
          Get the database name of this LCC.
 java.lang.String getDeclaredGlobalTemporaryTablesSchemaName()
          Get the declared global temporary tables schema name.
 SchemaDescriptor getDefaultSchema()
          Get the current default schema
 java.lang.String getDrdaID()
          Get the DRDA ID of this LCC.
 ExecutionContext getExecutionContext()
          Get the current ExecutionContext.
 int getIdentifierCasing()
          Get casing for delimited identifiers.
 java.math.BigDecimal getIdentityValue()
          Get the identity column value most recently generated.
 int getInstanceNumber()
          Get the instance number of this LCC.
 LanguageConnectionFactory getLanguageConnectionFactory()
          Get the language connection factory to use with this language connection context.
 LanguageFactory getLanguageFactory()
          Get the language factory to use with this language connection context.
 Activation getLastActivation()
          Return the last activation added This is used to find the drop activation in dropViewCascade so we can add warning messages to the activation
 int getLockEscalationThreshold()
          get the lock escalation threshold to use with this connection.
 java.lang.Object getLockObject(int lockScope)
          Get the lock handle for the current transaction.
 boolean getLogQueryPlan()
          Get value of logQueryPlan.
 boolean getLogStatementText()
          Get value of logStatementText.
 OptimizerFactory getOptimizerFactory()
          get the optimizer factory to use with this language connection context.
 boolean getOptimizerTrace()
          Get whether or not optimizer trace is on.
 boolean getOptimizerTraceHtml()
          Get whether or not optimizer trace html is on.
 java.lang.String getOptimizerTraceOutput()
          Get the optimizer trace output for the last optimized query as a String.
 int getPrepareIsolationLevel()
          Get the prepare isolation level.
 boolean getRunTimeStatisticsMode()
          Get the RUNTIMESTATISTICS mode.
 RunTimeStatistics getRunTimeStatisticsObject()
          Get the RUNTIMESTATISTICS object.
 StatementContext getStatementContext()
          Get the current StatementContext.
 int getStatementDepth()
          Reports how many statement levels deep we are.
 boolean getStatisticsTiming()
          Get the STATISTICS TIMING mode.
 java.lang.String getSysIBMSchemaName()
          Get the SYSIBM schema name.
 java.lang.String getSystemDiagSchemaName()
          Get the SYSCS_DIAG schema name.
 java.lang.String getSystemSchemaName()
          Get the system schema name.
 java.lang.String getSystemUtilSchemaName()
          Get the SYSCS_UTIL schema name.
 TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(java.lang.String tableName)
          Get table descriptor for the declared global temporary table from the list of temporary tables known by this connection.
 TransactionController getTransactionCompile()
          Get the transaction controller to use with this language connection context at compile time.
 TransactionController getTransactionExecute()
          Get the transaction controller to use with this language connection context during execute time.
 TriggerExecutionContext getTriggerExecutionContext()
          Get the topmost tec.
 TableDescriptor getTriggerTable()
          Get the topmost trigger table descriptor
 java.lang.String getUniqueCursorName()
          Get a connection unique system generated name for a cursor.
 int getUniqueSavepointID()
          Get a connection unique system generated id for an unnamed savepoint.
 java.lang.String getUniqueSavepointName()
          Get a connection unique system generated name for an unnamed savepoint.
 int incrementBindCount()
          Increment the DataDictionary bind count.
 void initialize(boolean sqlConnection)
          Initialize.
 void internalCommit(boolean commitStore)
          Do a commit, as internally needed by Cloudscape.
 void internalCommitNoSync(int commitflag)
          Similar to internalCommit() but has logic for an unsynchronized commit
 void internalRollback()
          Do a rollback, as internally needed by Cloudscape.
 void internalRollbackToSavepoint(java.lang.String savepointName, boolean refreshStyle, java.lang.Object kindOfSavepoint)
          Let the context deal with a rollback to savepoint
 boolean isReadOnly()
          Get the readOnly status for the current connection.
 boolean isTransactionPristine()
          Reports whether there is any outstanding work in the transaction.
 void languageSetSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint)
          Sets a savepoint.
 java.lang.Long lastAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
          Returns the last autoincrement value inserted by this connection.
 CursorActivation lookupCursorActivation(java.lang.String cursorName)
          See if a given cursor is available for use.
 void markTempTableAsModifiedInUnitOfWork(java.lang.String tableName)
          Mark the passed temporary table as modified in the current unit of work.
 long nextAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
          returns the next value to be inserted into an autoincrement col.
 void popCompilerContext(CompilerContext compilerContext)
          Pop a CompilerContext off the context stack.
 void popExecutionStmtValidator(ExecutionStmtValidator validator)
          Remove the validator.
 void popStatementContext(StatementContext statementContext, java.lang.Throwable error)
          Pop a StatementContext of the context stack.
 void popTriggerExecutionContext(TriggerExecutionContext tec)
          Remove the tec.
 void popTriggerTable(TableDescriptor td)
          Remove the trigger table descriptor.
 PreparedStatement prepareInternalStatement(SchemaDescriptor compilationSchema, java.lang.String sqlText)
           
 PreparedStatement prepareInternalStatement(java.lang.String sqlText)
          Return a compiled Statement object.
 CompilerContext pushCompilerContext()
          Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against.
 CompilerContext pushCompilerContext(SchemaDescriptor sd)
          Push a CompilerContext on the context stack with the passed in default schema as the default schema we compile against.
 void pushExecutionStmtValidator(ExecutionStmtValidator validator)
          Push a new execution statement validator.
 StatementContext pushStatementContext(boolean isAtomic, java.lang.String stmtText, ParameterValueSet pvs, boolean rollbackParentContext)
          Push a StatementContext on the context stack.
 void pushTriggerExecutionContext(TriggerExecutionContext tec)
          Push a new trigger execution context.
 void pushTriggerTable(TableDescriptor td)
          Set the trigger table descriptor.
 void releaseSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint)
          Let the context deal with a release of a savepoint
 void removeActivation(Activation a)
          Remove the activation from those known about by this connection.
 void setAutoincrementUpdate(boolean flag)
          Sets autoincrementUpdate-- this variable allows updates to autoincrement columns if it is set to true.
 void setDataDictionaryWriteMode()
          Remember that the DataDictionary is in write mode, so we can take it out of write mode at the end of the transaction.
 void setDefaultSchema(SchemaDescriptor sd)
          Set the current default schema
 void setDrdaID(java.lang.String drdaID)
          Set the DRDA ID of this LCC.
 void setIdentityValue(long val)
          Set the field of most recently generated identity column value.
 void setIsolationLevel(int isolationLevel)
          Set current isolation level.
 void setLogStatementText(boolean logStatementText)
          Set value of logStatementText (Whether or not to write info on currently executing statement to error log.)
 boolean setOptimizerTrace(boolean onOrOff)
          Control whether or not optimizer trace is on.
 boolean setOptimizerTraceHtml(boolean onOrOff)
          Control whether or not optimizer trace is generated in html.
 void setOptimizerTraceOutput(java.lang.String startingText)
          Set the optimizer trace output to the specified String.
 void setPrepareIsolationLevel(int isolationLevel)
           
 void setReadOnly(boolean onOrOff)
          Set the readOnly status for the current connection.
 void setRunTimeStatisticsMode(boolean onOrOff)
          Turn RUNTIMESTATISTICS on or off.
 void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
          Set the RUNTIMESTATISTICS object.
 void setStatisticsTiming(boolean onOrOff)
          Turn STATISTICS TIMING on or off.
 void setTransaction(TransactionController tran)
          Sets the transaction controller to use with this language connection context.
 void userCommit()
          Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement.
 void userRollback()
          Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement.
 void validateStmtExecution(ConstantAction constantAction)
          Validate a statement.
 boolean verifyAllHeldResultSetsAreClosed()
          Verify that there are no activations with open held result sets.
 boolean verifyNoOpenResultSets(PreparedStatement pStmt, Provider provider, int action)
          Verify that there are no activations with open result sets on the specified prepared statement.
 void xaCommit(boolean onePhase)
          Commit a distrubuted transaction.
 void xaRollback()
          Roll back a distrubuted transaction.
 
Methods inherited from interface org.apache.derby.iapi.services.context.Context
cleanupOnError, getContextManager, getIdName, isLastHandler, popMe, pushMe
 

Field Detail

CONTEXT_ID

public static final java.lang.String CONTEXT_ID
this is the ID we expect these contexts to be stored into a context manager under.

See Also:
Constant Field Values

OUTERMOST_STATEMENT

public static final int OUTERMOST_STATEMENT
See Also:
Constant Field Values

SQL92_SCHEMAS

public static final int SQL92_SCHEMAS
See Also:
Constant Field Values

USER_NAME_SCHEMA

public static final int USER_NAME_SCHEMA
See Also:
Constant Field Values

NO_SCHEMAS

public static final int NO_SCHEMAS
See Also:
Constant Field Values

xidStr

public static final java.lang.String xidStr
See Also:
Constant Field Values

lccStr

public static final java.lang.String lccStr
See Also:
Constant Field Values

dbnameStr

public static final java.lang.String dbnameStr
See Also:
Constant Field Values

drdaStr

public static final java.lang.String drdaStr
See Also:
Constant Field Values

SINGLE_TRANSACTION_LOCK

public static final int SINGLE_TRANSACTION_LOCK
See Also:
Constant Field Values

MULTI_TRANSACTION_LOCK

public static final int MULTI_TRANSACTION_LOCK
See Also:
Constant Field Values

UNKNOWN_CASING

public static final int UNKNOWN_CASING
See Also:
Constant Field Values

ANSI_CASING

public static final int ANSI_CASING
See Also:
Constant Field Values

ANTI_ANSI_CASING

public static final int ANTI_ANSI_CASING
See Also:
Constant Field Values
Method Detail

initialize

public void initialize(boolean sqlConnection)
                throws StandardException
Initialize. For use after pushing the contexts that initialization needs.

Parameters:
sqlConnection - Whether or not this is called from a sql connection.
Throws:
StandardException - thrown if something goes wrong

getLogStatementText

public boolean getLogStatementText()
Get value of logStatementText. (Whether or not to write info on currently executing statement to error log.)

Returns:
value of logStatementText

setLogStatementText

public void setLogStatementText(boolean logStatementText)
Set value of logStatementText (Whether or not to write info on currently executing statement to error log.)

Parameters:
logStatementText - Whether or not logStatementText property is set.
Returns:
Nothing.

getLogQueryPlan

public boolean getLogQueryPlan()
Get value of logQueryPlan. (Whether or not to write query plan info on currently executing statement to error log.)

Returns:
value of logQueryPlan

getLockEscalationThreshold

public int getLockEscalationThreshold()
get the lock escalation threshold to use with this connection.


addActivation

public void addActivation(Activation a)
Add the activation to those known about by this connection.


removeActivation

public void removeActivation(Activation a)
                      throws StandardException
Remove the activation from those known about by this connection.

Throws:
StandardException - thrown if something goes wrong

getActivationCount

public int getActivationCount()
Return the number of activation known for this connection.


lookupCursorActivation

public CursorActivation lookupCursorActivation(java.lang.String cursorName)
See if a given cursor is available for use. This is used to locate the cursor during its execution.

Returns:
the activation for the given cursor, null if none exists.

getLastActivation

public Activation getLastActivation()
Return the last activation added This is used to find the drop activation in dropViewCascade so we can add warning messages to the activation


getUniqueCursorName

public java.lang.String getUniqueCursorName()
Get a connection unique system generated name for a cursor.


getUniqueSavepointName

public java.lang.String getUniqueSavepointName()
Get a connection unique system generated name for an unnamed savepoint.


getUniqueSavepointID

public int getUniqueSavepointID()
Get a connection unique system generated id for an unnamed savepoint.


checkIfAnyDeclaredGlobalTempTablesForThisConnection

public boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
Check if there are any global temporary tables declared for this connection.

Returns:
true if there are declared temp tables for this connectoin else false

markTempTableAsModifiedInUnitOfWork

public void markTempTableAsModifiedInUnitOfWork(java.lang.String tableName)
Mark the passed temporary table as modified in the current unit of work. That information will be used at rollback time The compile phase will generate code to call this method if the DML is on a temporary table


addDeclaredGlobalTempTable

public void addDeclaredGlobalTempTable(TableDescriptor td)
                                throws StandardException
Add the declared global temporary table to the list of temporary tables known by this connection.

Throws:
StandardException

dropDeclaredGlobalTempTable

public boolean dropDeclaredGlobalTempTable(java.lang.String tableName)
Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.

Returns:
true if dropped the temporary table. False if no such temporary table exists.
See Also:
TempTableInfo

getTableDescriptorForDeclaredGlobalTempTable

public TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(java.lang.String tableName)
Get table descriptor for the declared global temporary table from the list of temporary tables known by this connection.

Returns:
TableDescriptor if found the temporary table. Else return null

dropAllDeclaredGlobalTempTables

public void dropAllDeclaredGlobalTempTables()
                                     throws StandardException
Drop all the declared global temporary tables associated with this connection. This gets called when a getConnection() is done on a PooledConnection. This will ensure all the temporary tables declared on earlier connection handle associated with this physical database connection are dropped before a new connection handle is issued on that same physical database connection.

Throws:
StandardException

internalCommit

public void internalCommit(boolean commitStore)
                    throws StandardException
Do a commit, as internally needed by Cloudscape. E.g. a commit for sync, or a commit for autocommit. Skips checks that a user isn't doing something bad like issuing a commit in a nested xact.

Parameters:
commitStore - true if we should commit the Store transaction
Returns:
the commit instant
Throws:
StandardException - thrown if something goes wrong

internalCommitNoSync

public void internalCommitNoSync(int commitflag)
                          throws StandardException
Similar to internalCommit() but has logic for an unsynchronized commit

Parameters:
commitflag - the flags to pass to commitNoSync in the store's TransactionController
Returns:
the commit instant
Throws:
StandardException - thrown if something goes wrong

userCommit

public void userCommit()
                throws StandardException
Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement.

Returns:
the commit instant
Throws:
StandardException - thrown if something goes wrong

xaCommit

public void xaCommit(boolean onePhase)
              throws StandardException
Commit a distrubuted transaction.

Parameters:
onePhase - if true, allow it to commit without first going thru a prepared state.
Returns:
the commit instant
Throws:
StandardException - thrown if something goes wrong

internalRollback

public void internalRollback()
                      throws StandardException
Do a rollback, as internally needed by Cloudscape. E.g. a rollback for sync, or a rollback for an internal error. Skips checks that a user isn't doing something bad like issuing a rollback in a nested xact.

Throws:
StandardException - thrown if something goes wrong

userRollback

public void userRollback()
                  throws StandardException
Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement.

Throws:
StandardException - thrown if something goes wrong

internalRollbackToSavepoint

public void internalRollbackToSavepoint(java.lang.String savepointName,
                                        boolean refreshStyle,
                                        java.lang.Object kindOfSavepoint)
                                 throws StandardException
Let the context deal with a rollback to savepoint

Parameters:
savepointName - Name of the savepoint that needs to be rolled back
refreshStyle - boolean indicating whether or not the controller should close open conglomerates and scans. Also used to determine if language should close open activations.
kindOfSavepoint - A NULL value means it is an internal savepoint (ie not a user defined savepoint) Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint A String value for kindOfSavepoint would mean it is SQL savepoint A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint
Throws:
StandardException - thrown if something goes wrong

releaseSavePoint

public void releaseSavePoint(java.lang.String savepointName,
                             java.lang.Object kindOfSavepoint)
                      throws StandardException
Let the context deal with a release of a savepoint

Parameters:
savepointName - Name of the savepoint that needs to be released
kindOfSavepoint - A NULL value means it is an internal savepoint (ie not a user defined savepoint) Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint A String value for kindOfSavepoint would mean it is SQL savepoint A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint
Throws:
StandardException - thrown if something goes wrong

xaRollback

public void xaRollback()
                throws StandardException
Roll back a distrubuted transaction.

Throws:
StandardException - thrown if something goes wrong

languageSetSavePoint

public void languageSetSavePoint(java.lang.String savepointName,
                                 java.lang.Object kindOfSavepoint)
                          throws StandardException
Sets a savepoint. Causes the Store to set a savepoint.

Parameters:
savepointName - name of savepoint
kindOfSavepoint - A NULL value means it is an internal savepoint (ie not a user defined savepoint) Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint A String value for kindOfSavepoint would mean it is SQL savepoint A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint
Throws:
StandardException - thrown if something goes wrong

anyoneBlocked

public boolean anyoneBlocked()
Returns true if any transaction is blocked (even if not by this one)


setTransaction

public void setTransaction(TransactionController tran)
Sets the transaction controller to use with this language connection context.

Parameters:
tran - the transaction to use with this language connection context

beginNestedTransaction

public void beginNestedTransaction(boolean readOnly)
                            throws StandardException
Begin a nested transaction.

Parameters:
readOnly - The nested transaction would be read only if param value true
Throws:
StandardException - on error.
See Also:
TransactionController.startNestedUserTransaction(boolean)

commitNestedTransaction

public void commitNestedTransaction()
                             throws StandardException
commit a nested transaction. We do not provide a abortNestedTransaction. If a nested xaction is aborted, then this results in the parent xaction also being aborted. This is not what we need for releasing compile time locks or autoincrement-- hence we do not provide abortNestedTransaction.

Throws:
StandardException - thrown on erro
See Also:
TransactionController.startNestedUserTransaction(boolean)

getTransactionCompile

public TransactionController getTransactionCompile()
Get the transaction controller to use with this language connection context at compile time.


getTransactionExecute

public TransactionController getTransactionExecute()
Get the transaction controller to use with this language connection context during execute time.


getSystemSchemaName

public java.lang.String getSystemSchemaName()
                                     throws StandardException
Get the system schema name.

Returns:
a String containing the system schema name.
Throws:
StandardException

getSysIBMSchemaName

public java.lang.String getSysIBMSchemaName()
                                     throws StandardException
Get the SYSIBM schema name.

Returns:
a String containing the SYSIBM schema name.
Throws:
StandardException

getSystemDiagSchemaName

public java.lang.String getSystemDiagSchemaName()
                                         throws StandardException
Get the SYSCS_DIAG schema name.

Returns:
a String containing the SYSIBM schema name.
Throws:
StandardException

getSystemUtilSchemaName

public java.lang.String getSystemUtilSchemaName()
                                         throws StandardException
Get the SYSCS_UTIL schema name.

Returns:
a String containing the SYSIBM schema name.
Throws:
StandardException

getDataDictionary

public DataDictionary getDataDictionary()
Get the data dictionary

Returns:
the data dictionary

getDataValueFactory

public DataValueFactory getDataValueFactory()
Get the data value factory to use with this language connection context.


getLanguageFactory

public LanguageFactory getLanguageFactory()
Get the language factory to use with this language connection context.


getOptimizerFactory

public OptimizerFactory getOptimizerFactory()
get the optimizer factory to use with this language connection context.


getLanguageConnectionFactory

public LanguageConnectionFactory getLanguageConnectionFactory()
Get the language connection factory to use with this language connection context.


getAuthorizationId

public java.lang.String getAuthorizationId()
Get the Authorization Id

Returns:
String the authorization id

getDeclaredGlobalTemporaryTablesSchemaName

public java.lang.String getDeclaredGlobalTemporaryTablesSchemaName()
                                                            throws StandardException
Get the declared global temporary tables schema name.

Returns:
a String containing the declared global temporary tables schema name.
Throws:
StandardException

getDefaultSchema

public SchemaDescriptor getDefaultSchema()
Get the current default schema

Returns:
SchemaDescriptor the current schema

setDefaultSchema

public void setDefaultSchema(SchemaDescriptor sd)
                      throws StandardException
Set the current default schema

Throws:
StandardException - thrown on failure

getCurrentSchemaName

public java.lang.String getCurrentSchemaName()
Get the current schema name

Returns:
SchemaDescriptor the current schema

getIdentityValue

public java.math.BigDecimal getIdentityValue()
Get the identity column value most recently generated.

Returns:
the generated identity column value

setIdentityValue

public void setIdentityValue(long val)
Set the field of most recently generated identity column value.


verifyNoOpenResultSets

public boolean verifyNoOpenResultSets(PreparedStatement pStmt,
                                      Provider provider,
                                      int action)
                               throws StandardException
Verify that there are no activations with open result sets on the specified prepared statement.

Parameters:
pStmt - The prepared Statement
provider - The object precipitating a possible invalidation
action - The action causing the possible invalidation
Returns:
Nothing.
Throws:
StandardException - thrown on failure

verifyAllHeldResultSetsAreClosed

public boolean verifyAllHeldResultSetsAreClosed()
                                         throws StandardException
Verify that there are no activations with open held result sets.

Returns:
boolean Found no open resultsets.
Throws:
StandardException - thrown on failure

pushCompilerContext

public CompilerContext pushCompilerContext()
Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against.

Returns:
the compiler context
Throws:
StandardException - thrown on failure

pushCompilerContext

public CompilerContext pushCompilerContext(SchemaDescriptor sd)
Push a CompilerContext on the context stack with the passed in default schema as the default schema we compile against.

Parameters:
sd - the default schema
Returns:
the compiler context
Throws:
StandardException - thrown on failure

popCompilerContext

public void popCompilerContext(CompilerContext compilerContext)
Pop a CompilerContext off the context stack.

Parameters:
compilerContext - The compiler context.
Returns:
Nothing.
Throws:
StandardException - thrown on failure

pushStatementContext

public StatementContext pushStatementContext(boolean isAtomic,
                                             java.lang.String stmtText,
                                             ParameterValueSet pvs,
                                             boolean rollbackParentContext)
Push a StatementContext on the context stack.

Parameters:
isAtomic - whether a commit/rollback is permitted from a nested connection under this statement
stmtText - the text of the statement. Needed for any language statement (currently, for any statement that can cause a trigger to fire). Please set this unless you are some funky jdbc setXXX method or something.
pvs - parameter value set, if it has one
rollbackParentContext - True if 1) the statement context is NOT a top-level context, AND 2) in the event of a statement-level exception, the parent context needs to be rolled back, too.
Returns:
StatementContext The statement context.

popStatementContext

public void popStatementContext(StatementContext statementContext,
                                java.lang.Throwable error)
Pop a StatementContext of the context stack.

Parameters:
statementContext - The statement context.
error - The error, if any (Only relevant for DEBUG)
Returns:
Nothing.

pushExecutionStmtValidator

public void pushExecutionStmtValidator(ExecutionStmtValidator validator)
Push a new execution statement validator. An execution statement validator is an object that validates the current statement to ensure that it is permitted given the current execution context. An example of a validator a trigger ExecutionStmtValidator that doesn't allow ddl on the trigger target table.

Multiple ExecutionStmtValidators may be active at any given time. This mirrors the way there can be multiple connection nestings at a single time. The validation is performed by calling each validator's validateStatement() method. This yields the union of all validations.

Parameters:
validator - the validator to add

popExecutionStmtValidator

public void popExecutionStmtValidator(ExecutionStmtValidator validator)
                               throws StandardException
Remove the validator. Does an object identity (validator == validator) comparison. Asserts that the validator is found.

Parameters:
validator - the validator to remove
Throws:
StandardException - on error

validateStmtExecution

public void validateStmtExecution(ConstantAction constantAction)
                           throws StandardException
Validate a statement. Does so by stepping through all the validators and executing them. If a validator throws and exception, then the checking is stopped and the exception is passed up.

Parameters:
constantAction - the constantAction that is about to be executed (and should be validated
Throws:
StandardException - on validation failure

pushTriggerExecutionContext

public void pushTriggerExecutionContext(TriggerExecutionContext tec)
                                 throws StandardException
Push a new trigger execution context.

Multiple TriggerExecutionContexts may be active at any given time.

Parameters:
tec - the trigger execution context
Throws:
StandardException - on trigger recursion error

popTriggerExecutionContext

public void popTriggerExecutionContext(TriggerExecutionContext tec)
                                throws StandardException
Remove the tec. Does an object identity (tec == tec) comparison. Asserts that the tec is found.

Parameters:
tec - the tec to remove
Throws:
StandardException - on error

getTriggerExecutionContext

public TriggerExecutionContext getTriggerExecutionContext()
Get the topmost tec.

Returns:
the tec

pushTriggerTable

public void pushTriggerTable(TableDescriptor td)
Set the trigger table descriptor. Used to compile statements that may special trigger pseudo tables.

Parameters:
td - the table that the trigger is defined upon

popTriggerTable

public void popTriggerTable(TableDescriptor td)
Remove the trigger table descriptor.

Parameters:
td - the table to remove from the stack.

getTriggerTable

public TableDescriptor getTriggerTable()
Get the topmost trigger table descriptor

Returns:
the table descriptor, or null if we aren't in the middle of compiling a create trigger.

incrementBindCount

public int incrementBindCount()
Increment the DataDictionary bind count. This is for keeping track of nested binding, which can happen if SQL statements are bound from within static initializers.

Returns:
The new bind count

decrementBindCount

public int decrementBindCount()
Decrement the DataDictionary bind count.

Returns:
The new bind count

getBindCount

public int getBindCount()
Get the DataDictionary bind count.

Returns:
The current bind count.

setDataDictionaryWriteMode

public void setDataDictionaryWriteMode()
Remember that the DataDictionary is in write mode, so we can take it out of write mode at the end of the transaction.


dataDictionaryInWriteMode

public boolean dataDictionaryInWriteMode()
Return true if the data dictionary is in write mode (that is, this context was informed that is is in write mode by the method call setDataDictionaryWriteMode().


setRunTimeStatisticsMode

public void setRunTimeStatisticsMode(boolean onOrOff)
Turn RUNTIMESTATISTICS on or off.


getRunTimeStatisticsMode

public boolean getRunTimeStatisticsMode()
Get the RUNTIMESTATISTICS mode.


setStatisticsTiming

public void setStatisticsTiming(boolean onOrOff)
Turn STATISTICS TIMING on or off.


getStatisticsTiming

public boolean getStatisticsTiming()
Get the STATISTICS TIMING mode.


setRunTimeStatisticsObject

public void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
Set the RUNTIMESTATISTICS object.


getRunTimeStatisticsObject

public RunTimeStatistics getRunTimeStatisticsObject()
Get the RUNTIMESTATISTICS object.


getStatementDepth

public int getStatementDepth()
Reports how many statement levels deep we are.

Returns:
a statement level >= OUTERMOST_STATEMENT

getDatabase

public Database getDatabase()
Returns the Database of this connection.


setIsolationLevel

public void setIsolationLevel(int isolationLevel)
                       throws StandardException
Set current isolation level.

Parameters:
isolationLevel - The new isolationLevel.
Returns:
Nothing.
Throws:
StandardException

getCurrentIsolationLevel

public int getCurrentIsolationLevel()
Get the current isolation level.

Returns:
The current isolation level.

getCurrentIsolationLevelStr

public java.lang.String getCurrentIsolationLevelStr()
Get the current isolation level in DB2 format.

Returns:
The current isolation level as a 2 character string.

setPrepareIsolationLevel

public void setPrepareIsolationLevel(int isolationLevel)

getPrepareIsolationLevel

public int getPrepareIsolationLevel()
Get the prepare isolation level. If the isolation level has been explicitly set with a SQL statement or embedded call to setTransactionIsolation, this will return ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL SET ISOLATION always takes priority.


setReadOnly

public void setReadOnly(boolean onOrOff)
                 throws StandardException
Set the readOnly status for the current connection. This can only be called when the current transaction has not done any work.

Parameters:
onOrOff - true sets the connection to be readOnly and false sets it to readWrite.
Throws:
StandardException - The call failed and the readOnly status has not changed.

isReadOnly

public boolean isReadOnly()
Get the readOnly status for the current connection.


getAuthorizer

public Authorizer getAuthorizer()
Get an Authorizer for this connection.


getExecutionContext

public ExecutionContext getExecutionContext()
Get the current ExecutionContext.


getStatementContext

public StatementContext getStatementContext()
Get the current StatementContext.


getAccessFactory

public AccessFactory getAccessFactory()
Get the AccessFactory cached in this LanguageConnectionContext


prepareInternalStatement

public PreparedStatement prepareInternalStatement(java.lang.String sqlText)
                                           throws StandardException
Return a compiled Statement object. The schema and unicode setting fo the returned statement are that of this connection.

Throws:
StandardException

prepareInternalStatement

public PreparedStatement prepareInternalStatement(SchemaDescriptor compilationSchema,
                                                  java.lang.String sqlText)
                                           throws StandardException
Throws:
StandardException

setOptimizerTrace

public boolean setOptimizerTrace(boolean onOrOff)
Control whether or not optimizer trace is on.

Parameters:
onOrOff - Whether to turn optimizer trace on (true) or off (false).
Returns:
Whether or not the call was successful. (false will be returned when optimizer tracing is not supported.)

getOptimizerTrace

public boolean getOptimizerTrace()
Get whether or not optimizer trace is on.

Returns:
Whether or not optimizer trace is on.

setOptimizerTraceHtml

public boolean setOptimizerTraceHtml(boolean onOrOff)
Control whether or not optimizer trace is generated in html.

Parameters:
onOrOff - Whether or not optimizer trace will be in html (true) or not (false).
Returns:
Whether or not the call was successful. (false will be returned when optimizer tracing is not supported.)

getOptimizerTraceHtml

public boolean getOptimizerTraceHtml()
Get whether or not optimizer trace html is on.

Returns:
Whether or not optimizer trace html is on.

getOptimizerTraceOutput

public java.lang.String getOptimizerTraceOutput()
Get the optimizer trace output for the last optimized query as a String. If optimizer trace html is on, then the String will contain the html tags.

Returns:
The optimizer trace output for the last optimized query as a String. Null will be returned if optimizer trace output is off or not supported or no trace output was found or an exception occurred.

setOptimizerTraceOutput

public void setOptimizerTraceOutput(java.lang.String startingText)
Set the optimizer trace output to the specified String. (Done at the beginning of each statement.)


appendOptimizerTraceOutput

public void appendOptimizerTraceOutput(java.lang.String output)
Append the latest output to the optimizer trace output.


isTransactionPristine

public boolean isTransactionPristine()
Reports whether there is any outstanding work in the transaction.

Returns:
true if there is outstanding work in the transaction false otherwise

getLockObject

public java.lang.Object getLockObject(int lockScope)
                               throws StandardException
Get the lock handle for the current transaction.

Parameters:
lockScope - SINGLE_TRANSACTION_LOCK or MULTI_TRANSACTION_LOCK
Returns:
the current lock handle
Throws:
StandardException - thrown if something goes wrong

getIdentifierCasing

public int getIdentifierCasing()
                        throws StandardException
Get casing for delimited identifiers. This feature is here to support the Plugin.

Returns:
ANSI_CASING or ANTI_ANSI_CASING.
Throws:
StandardException - thrown if something goes wrong

convertIdentifierCase

public java.lang.String convertIdentifierCase(java.lang.String id)
                                       throws StandardException
Convert an identifier to the proper case for this connection. This method is here to support the Plugin.

Returns:
the string converted to upper or lower case, as appropriate
Throws:
StandardException - thrown if something goes wrong

lastAutoincrementValue

public java.lang.Long lastAutoincrementValue(java.lang.String schemaName,
                                             java.lang.String tableName,
                                             java.lang.String columnName)
Returns the last autoincrement value inserted by this connection. If no values have been inserted into the given column a NULL value is returned.

Parameters:
schemaName -
tableName -
columnName -

setAutoincrementUpdate

public void setAutoincrementUpdate(boolean flag)
Sets autoincrementUpdate-- this variable allows updates to autoincrement columns if it is set to true. The default is ofcourse false; i.e ai columns cannot be directly modified by the user. This is set to true by AlterTableConstantAction, when a new ai column is being added to an existing table.

Parameters:
flag - the value for autoincrementUpdate (TRUE or FALSE)
See Also:
AlterTableConstantAction.updateNewAutoincrementColumn(org.apache.derby.iapi.sql.Activation, java.lang.String, long, long)

getAutoincrementUpdate

public boolean getAutoincrementUpdate()
Returns the current value of autoincrementUpdate.

Returns:
true if updates to autoincrement columns is permitted.

copyHashtableToAIHT

public void copyHashtableToAIHT(java.util.Hashtable from)
copy a hashtable of autoincrement key value pairs into the cache of ai values stored in the language connection context.


nextAutoincrementValue

public long nextAutoincrementValue(java.lang.String schemaName,
                                   java.lang.String tableName,
                                   java.lang.String columnName)
                            throws StandardException
returns the next value to be inserted into an autoincrement col. This is used internally by the system to generate autoincrement values which are going to be inserted into a autoincrement column. This is used when as autoincrement column is added to a table by an alter table statemenet and during bulk insert.

Parameters:
schemaName -
tableName -
columnName - identify the column uniquely in the system.
Throws:
StandardException - on error.

autoincrementFlushCache

public void autoincrementFlushCache(UUID tableUUID)
                             throws StandardException
Flush the cache of autoincrement values being kept by the lcc. This will result in the autoincrement values being written to the SYSCOLUMNS table as well as the mapping used by lastAutoincrementValue

Parameters:
tableUUID - the table which is being flushed; we need this value to identify the table for which the autoincrement counter is being maintained.
Throws:
StandardException - thrown on error.
See Also:
lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String), GenericLanguageConnectionContext.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String), ConnectionInfo.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)

autoincrementCreateCounter

public void autoincrementCreateCounter(java.lang.String s,
                                       java.lang.String t,
                                       java.lang.String c,
                                       java.lang.Long initialValue,
                                       long increment,
                                       int position)
Create an autoincrement counter to be used on behalf of a SQL-J statement. The counter is identified by (schemaName, tableName, columnName). The counter must be freed up by calling autoincrementFlushCache at the end of the statement. It is expected that a ai-counter with the same signaure doesn't exist when the method is called.

Parameters:
s - SchemaName
t - TableName
c - ColumnName
initialValue - initial value of the counter.
increment - increment for the counter.
position - column position (1-based).

getInstanceNumber

public int getInstanceNumber()
Get the instance number of this LCC.

Returns:
instance number of this LCC.

getDrdaID

public java.lang.String getDrdaID()
Get the DRDA ID of this LCC.

Returns:
DRDA ID this LCC.

setDrdaID

public void setDrdaID(java.lang.String drdaID)
Set the DRDA ID of this LCC.


getDbname

public java.lang.String getDbname()
Get the database name of this LCC.

Returns:
database name of this LCC.


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.