Home » db-derby-10.5.3.0 » org.apache.derby.iapi.sql.conn » [javadoc | source]
org.apache.derby.iapi.sql.conn
public interface: LanguageConnectionContext [javadoc | source]

All Implemented Interfaces:
    Context

All Known Implementing Classes:
    GenericLanguageConnectionContext

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.

Field Summary
public static final  String CONTEXT_ID    this is the ID we expect these contexts to be stored into a context manager under. 
public static final  int OUTERMOST_STATEMENT     
public static final  int SQL92_SCHEMAS     
public static final  int USER_NAME_SCHEMA     
public static final  int NO_SCHEMAS     
public static final  String xidStr     
public static final  String lccStr     
public static final  String dbnameStr     
public static final  String drdaStr     
public static final  int SINGLE_TRANSACTION_LOCK     
public static final  int MULTI_TRANSACTION_LOCK     
public static final  int UNKNOWN_CASING     
public static final  int ANSI_CASING     
public static final  int ANTI_ANSI_CASING     
Method from org.apache.derby.iapi.sql.conn.LanguageConnectionContext Summary:
addActivation,   addDeclaredGlobalTempTable,   appendOptimizerTraceOutput,   autoincrementCreateCounter,   autoincrementFlushCache,   beginNestedTransaction,   checkIfAnyDeclaredGlobalTempTablesForThisConnection,   closeUnusedActivations,   commitNestedTransaction,   copyHashtableToAIHT,   createSQLSessionContext,   dataDictionaryInWriteMode,   decrementBindCount,   dropDeclaredGlobalTempTable,   getActivationCount,   getAuthorizationId,   getAuthorizer,   getAutoincrementUpdate,   getBindCount,   getCurrentIsolationLevel,   getCurrentIsolationLevelStr,   getCurrentRoleId,   getCurrentRoleIdDelimited,   getCurrentSchemaName,   getCurrentSchemaName,   getDataDictionary,   getDataValueFactory,   getDatabase,   getDbname,   getDefaultSchema,   getDefaultSchema,   getDrdaID,   getIdentityValue,   getInstanceNumber,   getLanguageConnectionFactory,   getLanguageFactory,   getLastActivation,   getLastQueryTree,   getLockEscalationThreshold,   getLogQueryPlan,   getLogStatementText,   getOptimizerFactory,   getOptimizerTrace,   getOptimizerTraceHtml,   getOptimizerTraceOutput,   getPrepareIsolationLevel,   getRunTimeStatisticsMode,   getRunTimeStatisticsObject,   getStatementContext,   getStatementDepth,   getStatisticsTiming,   getTableDescriptorForDeclaredGlobalTempTable,   getTopLevelSQLSessionContext,   getTransactionCompile,   getTransactionExecute,   getTriggerExecutionContext,   getTriggerTable,   getUniqueCursorName,   getUniqueSavepointID,   getUniqueSavepointName,   incrementBindCount,   initialize,   internalCommit,   internalCommitNoSync,   internalRollback,   internalRollbackToSavepoint,   isInitialDefaultSchema,   isIsolationLevelSetUsingSQLorJDBC,   isReadOnly,   isTransactionPristine,   languageSetSavePoint,   lastAutoincrementValue,   lookupCursorActivation,   markTempTableAsModifiedInUnitOfWork,   nextAutoincrementValue,   notifyUnusedActivation,   popCompilerContext,   popExecutionStmtValidator,   popStatementContext,   popTriggerExecutionContext,   popTriggerTable,   prepareInternalStatement,   prepareInternalStatement,   pushCompilerContext,   pushCompilerContext,   pushExecutionStmtValidator,   pushStatementContext,   pushTriggerExecutionContext,   pushTriggerTable,   releaseSavePoint,   removeActivation,   resetFromPool,   resetIsolationLevelFlagUsedForSQLandJDBC,   resetSchemaUsages,   roleIsSettable,   setAutoincrementUpdate,   setCurrentRole,   setDataDictionaryWriteMode,   setDefaultSchema,   setDefaultSchema,   setDrdaID,   setIdentityValue,   setIsolationLevel,   setLastQueryTree,   setLogStatementText,   setOptimizerTrace,   setOptimizerTraceHtml,   setOptimizerTraceOutput,   setPrepareIsolationLevel,   setReadOnly,   setRunTimeStatisticsMode,   setRunTimeStatisticsObject,   setStatisticsTiming,   setupNestedSessionContext,   setupSubStatementSessionContext,   userCommit,   userRollback,   usesSqlAuthorization,   validateStmtExecution,   verifyAllHeldResultSetsAreClosed,   verifyNoOpenResultSets,   xaCommit,   xaRollback
Method from org.apache.derby.iapi.sql.conn.LanguageConnectionContext Detail:
 public  void addActivation(Activation a) throws StandardException
    Add the activation to those known about by this connection.
 public  void addDeclaredGlobalTempTable(TableDescriptor td) throws StandardException
    Add the declared global temporary table to the list of temporary tables known by this connection.
 public  void appendOptimizerTraceOutput(String output)
    Append the latest output to the optimizer trace output.
 public  void autoincrementCreateCounter(String s,
    String t,
    String c,
    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.
 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
 public  void beginNestedTransaction(boolean readOnly) throws StandardException
    Begin a nested transaction.
 public boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
    Check if there are any global temporary tables declared for this connection.
 public  void closeUnusedActivations() throws StandardException
    Close any unused activations in this connection context.
 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.
 public  void copyHashtableToAIHT(Map from)
    Copy a map of autoincrement key value pairs into the cache of ai values stored in the language connection context.
 public SQLSessionContext createSQLSessionContext()
    Create a fresh SQLSessionContext for this connection.
 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().
 public int decrementBindCount()
    Decrement the DataDictionary bind count.
 public boolean dropDeclaredGlobalTempTable(String tableName)
    Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.
 public int getActivationCount()
    Return the number of activation known for this connection.
 public String getAuthorizationId()
    Get the Authorization Id
 public Authorizer getAuthorizer()
    Get an Authorizer for this connection.
 public boolean getAutoincrementUpdate()
    Returns the current value of autoincrementUpdate.
 public int getBindCount()
    Get the DataDictionary bind count.
 public int getCurrentIsolationLevel()
    Get the current isolation level.
 public String getCurrentIsolationLevelStr()
    Get the current isolation level in DB2 format.
 public String getCurrentRoleId(Activation a)
    Get the current role authorization identifier of the dynamic call context associated with this activation.
 public String getCurrentRoleIdDelimited(Activation a) throws StandardException
    Get the current role authorization identifier in external delimited form (not case normal form) of the dynamic call context associated with this activation.
 public String getCurrentSchemaName()
    Get the current schema name (at compile-time, see explanations for getDefaultSchema overloads).
 public String getCurrentSchemaName(Activation a)
    Get the current schema name (at execution time, see explanations for getDefaultSchema overloads); This version is used by CURRENT SCHEMA.
 public DataDictionary getDataDictionary()
    Get the data dictionary
 public DataValueFactory getDataValueFactory()
    Get the data value factory to use with this language connection context.
 public Database getDatabase()
    Returns the Database of this connection.
 public String getDbname()
    Get the database name of this LCC.
 public SchemaDescriptor getDefaultSchema()
    Get the default schema (used at compile-time when no activation is yet available, cf. the activation argument overload version.
 public SchemaDescriptor getDefaultSchema(Activation a)
    Get the default schema (used at execution time). At execution time, the current statement context is not always a reliable place to find the correct SQL session context, viz. when a dynamic result set referencing CURRENT SCHEMA is accessed after a called procedure has returned only the activation of the call is live and still holds the correct session context.
 public String getDrdaID()
    Get the DRDA ID of this LCC.
 public Long getIdentityValue()
    Get the identity column value most recently generated.
 public int getInstanceNumber()
    Get the instance number of this LCC.
 public LanguageConnectionFactory getLanguageConnectionFactory()
    Get the language connection factory to use with this language connection context.
 public LanguageFactory getLanguageFactory()
    Get the language factory to use with this language connection context.
 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
 public Object getLastQueryTree()
    Debug method for retrieving the last query tree.
 public int getLockEscalationThreshold()
    get the lock escalation threshold to use with this connection.
 public boolean getLogQueryPlan()
    Get value of logQueryPlan. (Whether or not to write query plan info on currently executing statement to error log.)
 public boolean getLogStatementText()
    Get value of logStatementText. (Whether or not to write info on currently executing statement to error log.)
 public OptimizerFactory getOptimizerFactory()
    get the optimizer factory to use with this language connection context.
 public boolean getOptimizerTrace()
    Get whether or not optimizer trace is on.
 public boolean getOptimizerTraceHtml()
    Get whether or not optimizer trace html is on.
 public 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.
 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.
 public boolean getRunTimeStatisticsMode()
    Get the RUNTIMESTATISTICS mode.
 public RunTimeStatistics getRunTimeStatisticsObject()
    Get the RUNTIMESTATISTICS object.
 public StatementContext getStatementContext()
    Get the current StatementContext.
 public int getStatementDepth()
    Reports how many statement levels deep we are.
 public boolean getStatisticsTiming()
    Get the STATISTICS TIMING mode.
 public TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(String tableName)
    Get table descriptor for the declared global temporary table from the list of temporary tables known by this connection.
 public SQLSessionContext getTopLevelSQLSessionContext()
    Get the value of top level session context of the top level connection.
 public TransactionController getTransactionCompile()
    Get the transaction controller to use with this language connection context at compile time.
 public TransactionController getTransactionExecute()
    Get the transaction controller to use with this language connection context during execute time.
 public TriggerExecutionContext getTriggerExecutionContext()
    Get the topmost tec.
 public TableDescriptor getTriggerTable()
    Get the topmost trigger table descriptor
 public String getUniqueCursorName()
    Get a connection unique system generated name for a cursor.
 public int getUniqueSavepointID()
    Get a connection unique system generated id for an unnamed savepoint.
 public String getUniqueSavepointName()
    Get a connection unique system generated name for an unnamed savepoint.
 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.
 public  void initialize() throws StandardException
    Initialize. For use after pushing the contexts that initialization needs.
 public  void internalCommit(boolean commitStore) throws StandardException
    Do a commit, as internally needed by Derby. 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.
 public  void internalCommitNoSync(int commitflag) throws StandardException
    Similar to internalCommit() but has logic for an unsynchronized commit
 public  void internalRollback() throws StandardException
    Do a rollback, as internally needed by Derby. 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.
 public  void internalRollbackToSavepoint(String savepointName,
    boolean refreshStyle,
    Object kindOfSavepoint) throws StandardException
    Let the context deal with a rollback to savepoint
 public boolean isInitialDefaultSchema(String schemaName)
    Return true if this schema name is the initial default schema for the current session.
 public boolean isIsolationLevelSetUsingSQLorJDBC()
    Returns true if isolation level has been set using JDBC/SQL.
 public boolean isReadOnly()
    Get the readOnly status for the current connection.
 public boolean isTransactionPristine()
    Reports whether there is any outstanding work in the transaction.
 public  void languageSetSavePoint(String savepointName,
    Object kindOfSavepoint) throws StandardException
    Sets a savepoint. Causes the Store to set a savepoint.
 public Long lastAutoincrementValue(String schemaName,
    String tableName,
    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.
 public CursorActivation lookupCursorActivation(String cursorName)
    See if a given cursor is available for use. This is used to locate the cursor during its execution.
 public  void markTempTableAsModifiedInUnitOfWork(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
 public long nextAutoincrementValue(String schemaName,
    String tableName,
    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.
 public  void notifyUnusedActivation()
    Make a note that some activations are marked unused
 public  void popCompilerContext(CompilerContext compilerContext)
    Pop a CompilerContext off the context stack.
 public  void popExecutionStmtValidator(ExecutionStmtValidator validator) throws StandardException
    Remove the validator. Does an object identity (validator == validator) comparison. Asserts that the validator is found.
 public  void popStatementContext(StatementContext statementContext,
    Throwable error)
    Pop a StatementContext of the context stack.
 public  void popTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
    Remove the tec. Does an object identity (tec == tec) comparison. Asserts that the tec is found.
 public  void popTriggerTable(TableDescriptor td)
    Remove the trigger table descriptor.
 public PreparedStatement prepareInternalStatement(String sqlText) throws StandardException
    Return a PreparedStatement object for the query. This method first tries to locate the PreparedStatement object from a statement cache. If the statement is not found in the cache, the query will be compiled and put into the cache. The schema used when compiling the statement is the same schema as returned by getDefaultSchema(). For internal statements, the read only status is set to true. Calling this method is equivalent to calling prepareExternalStatement(lcc.getDefaultSchema(), sqlText, true);
 public PreparedStatement prepareInternalStatement(SchemaDescriptor compilationSchema,
    String sqlText,
    boolean isForReadOnly,
    boolean allowInternalSyntax) throws StandardException
    Return a PreparedStatement object for the query. This method first tries to locate the PreparedStatement object from a statement cache. If the statement is not found in the cache, the query will be compiled and put into the cache.
 public CompilerContext pushCompilerContext()
    Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against.
 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.
 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.

 public StatementContext pushStatementContext(boolean isAtomic,
    boolean isForReadOnly,
    String stmtText,
    ParameterValueSet pvs,
    boolean rollbackParentContext,
    long timeoutMillis)
    Push a StatementContext on the context stack.
 public  void pushTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
    Push a new trigger execution context.

    Multiple TriggerExecutionContexts may be active at any given time.

 public  void pushTriggerTable(TableDescriptor td)
    Set the trigger table descriptor. Used to compile statements that may special trigger pseudo tables.
 public  void releaseSavePoint(String savepointName,
    Object kindOfSavepoint) throws StandardException
    Let the context deal with a release of a savepoint
 public  void removeActivation(Activation a) throws StandardException
    Remove the activation from those known about by this connection.
 public  void resetFromPool() throws StandardException
    Reset the connection before it is returned (indirectly) by a PooledConnection object. See EmbeddedConnection.
 public  void resetIsolationLevelFlagUsedForSQLandJDBC()
    Reset the isolation level flag used to keep correct isolation level state in BrokeredConnection. This resetting will happen at the start and end of a global transaction, after the BrokeredConection's isolation level state is brought upto date with the EmbedConnection's isolation state. The flag gets set to true when isolation level is set using JDBC/SQL.
 public  void resetSchemaUsages(Activation activation,
    String schemaName) throws StandardException
    Reset any occurence of schemaName as current default schema in the SQLSessionContext stack to the initial default, because schemaName is no longer a valid schema.
 public boolean roleIsSettable(String role) throws StandardException
    Checks whether the given role can be legally set for the current user. This method will read (potentially) the dictionary, so it needs a transaction context.
 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.
 public  void setCurrentRole(Activation a,
    String role)
    Set the current role
 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.
 public  void setDefaultSchema(SchemaDescriptor sd) throws StandardException
    Set the default schema (at compile-time, see explanations for getDefaultSchema overloads).
 public  void setDefaultSchema(Activation a,
    SchemaDescriptor sd) throws StandardException
    Set the default schema (at execution time, see explanations for getDefaultSchema overloads); This version is used by SET SCHEMA.
 public  void setDrdaID(String drdaID)
    Set the DRDA ID of this LCC.
 public  void setIdentityValue(long val)
    Set the field of most recently generated identity column value.
 public  void setIsolationLevel(int isolationLevel) throws StandardException
    Set current isolation level.
 public  void setLastQueryTree(Object queryTree)
    Debug method for remembering the last query tree.
 public  void setLogStatementText(boolean logStatementText)
    Set value of logStatementText (Whether or not to write info on currently executing statement to error log.)
 public boolean setOptimizerTrace(boolean onOrOff)
    Control whether or not optimizer trace is on.
 public boolean setOptimizerTraceHtml(boolean onOrOff)
    Control whether or not optimizer trace is generated in html.
 public  void setOptimizerTraceOutput(String startingText)
    Set the optimizer trace output to the specified String. (Done at the beginning of each statement.)
 public  void setPrepareIsolationLevel(int isolationLevel)
 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.
 public  void setRunTimeStatisticsMode(boolean onOrOff)
    Turn RUNTIMESTATISTICS on or off.
 public  void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
    Set the RUNTIMESTATISTICS object.
 public  void setStatisticsTiming(boolean onOrOff)
    Turn STATISTICS TIMING on or off.
 public  void setupNestedSessionContext(Activation a)
    Create a new SQL session context for the current activation on the basis of the existing SQL session context. This happens when a stored procedure or function that can contain SQL is invoked, cf. SQL 2003 section 4.27.3, since this gives rise to a nested connection.

    Called from generated code, see {@code StaticMethodCallNode#generateSetupNestedSessionContext}.

    The new SQL session context is also set in the current statement context (of the invocation).

 public  void setupSubStatementSessionContext(Activation a)
    Used when a statement as part of its operation executes an other statement. In contrast to setupNestedSessionContext, the activation (for the substatement) just inherits the current session context from the parent statements activation, it does not push a new copy on the stack of session contexts. Currently, this is used in the following situations:
    • With {@code ALTER TABLE} adding a column which has a default values, the default value for all the existing rows is added using an {@code UPDATE} substatement.
    • With {@code ALTER TABLE} adding a a check constraint, we will use a substatement {@code SELECT} to check if all rows satisfy the constraint.
    • {@code ResultSet.insertRow}, {@code updateRow} and {@code deleteRow}.
    • During trigger body execution.
 public  void userCommit() throws StandardException
    Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement.
 public  void userRollback() throws StandardException
    Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement.
 public boolean usesSqlAuthorization()
    Check if in SQL standard mode, with support for Grant & Revoke
 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.
 public boolean verifyAllHeldResultSetsAreClosed() throws StandardException
    Verify that there are no activations with open held result sets.
 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.
 public  void xaCommit(boolean onePhase) throws StandardException
    Commit a distrubuted transaction.
 public  void xaRollback() throws StandardException
    Roll back a distrubuted transaction.