📄 languageconnectioncontext.java
字号:
/* Derby - Class org.apache.derby.iapi.sql.conn.LanguageConnectionContext Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */package org.apache.derby.iapi.sql.conn;import org.apache.derby.iapi.services.context.Context;import org.apache.derby.iapi.services.context.ContextManager;import org.apache.derby.iapi.db.Database;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.sql.compile.CompilerContext;import org.apache.derby.iapi.sql.dictionary.DataDictionary;import org.apache.derby.iapi.sql.dictionary.TableDescriptor;import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;import org.apache.derby.iapi.sql.compile.OptimizerFactory;import org.apache.derby.iapi.types.DataValueFactory;import org.apache.derby.iapi.sql.depend.Provider;import org.apache.derby.iapi.sql.execute.ConstantAction;import org.apache.derby.iapi.sql.execute.CursorActivation;import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;import org.apache.derby.iapi.sql.execute.ExecutionContext;import org.apache.derby.iapi.sql.execute.ExecutionStmtValidator;import org.apache.derby.iapi.sql.Activation;import org.apache.derby.iapi.sql.LanguageFactory;import org.apache.derby.iapi.sql.PreparedStatement;import org.apache.derby.iapi.sql.ResultSet;import org.apache.derby.iapi.sql.ParameterValueSet;import org.apache.derby.iapi.store.access.TransactionController;import org.apache.derby.iapi.store.access.AccessFactory;import org.apache.derby.iapi.db.TriggerExecutionContext;import org.apache.derby.iapi.services.i18n.LocaleFinder;import org.apache.derby.iapi.sql.execute.RunTimeStatistics;import org.apache.derby.catalog.UUID;import java.util.Locale;import java.util.Hashtable;import java.util.Vector;/** * LanguageConnectionContext keeps the result sets, * and activations in use by the current connection. * <p> * More stable items, like other factories, are accessible through * the LanguageConnectionFactory or the LanguageFactory. * * @see LanguageConnectionFactory * @see org.apache.derby.iapi.sql.LanguageFactory */public interface LanguageConnectionContext extends Context { /** * this is the ID we expect these contexts * to be stored into a context manager under. */ public static final String CONTEXT_ID = org.apache.derby.iapi.reference.ContextId.LANG_CONNECTION; public static final int OUTERMOST_STATEMENT = 1; // Constants describing how this connection handles schemas public static final int SQL92_SCHEMAS = 0; public static final int USER_NAME_SCHEMA = 1; // User names are schema names. public static final int NO_SCHEMAS = 2; // Schemas not implemented. /* String for logStatementText output */ public static final String xidStr = "(XID = "; public static final String lccStr = "(SESSIONID = "; public static final String dbnameStr = "(DATABASE = "; public static final String drdaStr = "(DRDAID = "; // Lock Management public static final int SINGLE_TRANSACTION_LOCK = 1; public static final int MULTI_TRANSACTION_LOCK = 2; // controls casing of NON-delimited identifiers. ANSI casing forces all // non-delimited identifiers to be lower case. public static final int UNKNOWN_CASING = -1; public static final int ANSI_CASING = 0; public static final int ANTI_ANSI_CASING = 1; /** * Initialize. For use after pushing the contexts that initialization needs. * * @param sqlConnection Whether or not this is called from a sql connection. * * @exception StandardException thrown if something goes wrong */ void initialize(boolean sqlConnection) throws StandardException; /** * Get value of logStatementText. * (Whether or not to write info on currently * executing statement to error log.) * * @return value of logStatementText */ public boolean getLogStatementText(); /** * Set value of logStatementText * (Whether or not to write info on currently * executing statement to error log.) * * @param logStatementText Whether or not logStatementText property is set. * * @return Nothing. */ public void setLogStatementText(boolean logStatementText); /** * Get value of logQueryPlan. * (Whether or not to write query plan info on currently * executing statement to error log.) * * @return value of logQueryPlan */ public boolean getLogQueryPlan(); /** * get the lock escalation threshold to use with this connection. */ int getLockEscalationThreshold(); /** * Add the activation to those known about by this connection. * */ void addActivation(Activation a); /** * Remove the activation from those known about by this connection. * * @exception StandardException thrown if something goes wrong */ void removeActivation(Activation a) throws StandardException; /** * Return the number of activation known for this connection. * */ int getActivationCount(); /** * See if a given cursor is available for use. This is used * to locate the cursor during its execution. * * @return the activation for the given cursor, null if none exists. */ CursorActivation lookupCursorActivation(String cursorName); /** * 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 Activation getLastActivation(); /** Get a connection unique system generated name for a cursor. */ public String getUniqueCursorName(); /** Get a connection unique system generated name for an unnamed savepoint. */ public String getUniqueSavepointName(); /** Get a connection unique system generated id for an unnamed savepoint. */ public int getUniqueSavepointID(); /** * Check if there are any global temporary tables declared for this connection. * @return true if there are declared temp tables for this connectoin else false * */ public boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection(); /** * 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 * * @param String tableName Mark the passed temporary table name as modified */ public void markTempTableAsModifiedInUnitOfWork(String tableName); /** * Add the declared global temporary table to the list of temporary tables known by this connection. * @param TableDescriptor td Corresponding to the temporary table * */ public void addDeclaredGlobalTempTable(TableDescriptor td) throws StandardException; /** * Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection. * @param String tableName look for this table name in the saved list and drop it if found * @return true if dropped the temporary table. False if no such temporary table exists. * * @see org.apache.derby.impl.sql.conn.TempTableInfo */ public boolean dropDeclaredGlobalTempTable(String tableName); /** * Get table descriptor for the declared global temporary table from the list of temporary * tables known by this connection. * @param String tableName Get table descriptor for the passed table name * @return TableDescriptor if found the temporary table. Else return null * */ public TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(String tableName); /** Reset the connection before it is returned (indirectly) by a PooledConnection object. See EmbeddedConnection. */ public void resetFromPool() 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. @param commitStore true if we should commit the Store transaction @return the commit instant @exception StandardException thrown if something goes wrong */ void internalCommit( boolean commitStore ) throws StandardException; /** Similar to internalCommit() but has logic for an unsynchronized commit @param commitflag the flags to pass to commitNoSync in the store's TransactionController @return the commit instant @exception StandardException thrown if something goes wrong */ void internalCommitNoSync(int commitflag) throws StandardException; /** Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement. @return the commit instant @exception StandardException thrown if something goes wrong */ void userCommit() throws StandardException; /** Commit a distrubuted transaction. @param onePhase if true, allow it to commit without first going thru a prepared state. @return the commit instant @exception StandardException thrown if something goes wrong */ void xaCommit(boolean onePhase) 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. @exception StandardException thrown if something goes wrong */ void internalRollback() throws StandardException; /** Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement. @exception StandardException thrown if something goes wrong */ void userRollback() throws StandardException; /** * Let the context deal with a rollback to savepoint * * @param savepointName Name of the savepoint that needs to be rolled back * @param refreshStyle boolean indicating whether or not the controller should close * open conglomerates and scans. Also used to determine if language should close * open activations. * @param 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 * * @exception StandardException thrown if something goes wrong */ void internalRollbackToSavepoint ( String savepointName, boolean refreshStyle, Object kindOfSavepoint ) throws StandardException; /** * Let the context deal with a release of a savepoint * * @param savepointName Name of the savepoint that needs to be released * @param 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 * * @exception StandardException thrown if something goes wrong */ void releaseSavePoint ( String savepointName, Object kindOfSavepoint ) throws StandardException; /** Roll back a distrubuted transaction. @exception StandardException thrown if something goes wrong */ void xaRollback() throws StandardException; /** Sets a savepoint. Causes the Store to set a savepoint. @param savepointName name of savepoint @param 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 @exception StandardException thrown if something goes wrong */ void languageSetSavePoint( String savepointName, Object kindOfSavepoint ) throws StandardException; /** Returns true if any transaction is blocked (even if not by this one) */ boolean anyoneBlocked(); /** Sets the transaction controller to use with this language connection context.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -