Class BaseActivation
- All Implemented Interfaces:
Dependable
,GeneratedByteCode
,Activation
,Dependent
,CursorActivation
- Direct Known Subclasses:
ConstantActionActivation
,CursorActivation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int[]
private String[]
private boolean
private Calendar
private boolean
protected boolean
protected ContextManager
private Stack
<ConstantAction> Stack of ConstantActions.private String
private TableDescriptor
private boolean
private CursorResultSet
private GeneratedClass
private long
protected int
private ScanController
private boolean
private boolean
By setting isValid to false, we can force a new activation to be used even if the prepared statement is still valid.private LanguageConnectionContext
private static final long
private long
protected int
private Activation
The 'parentActivation' of an activation of a statement executing in the root connection is null.protected Hashtable
<String, Vector<TemporaryRowHolder>> protected ExecPreparedStatement
protected ParameterValueSet
protected CursorResultSet[]
protected ResultDescription
protected ResultSet
private boolean
protected ExecRow[]
private boolean
private boolean
private SQLSessionContext
The SQL session context to be used inside a nested connection in a stored routine or in a substatement.private ResultSet
private static final int
private ConglomerateController
protected String
For dependency trackingprotected UUID
For dependency trackingprivate SQLWarning
Fields inherited from interface org.apache.derby.catalog.Dependable
ACTIVATION, ALIAS, COLUMNS_IN_TABLE, COLUMNS_PERMISSION, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PERM, PREPARED_STATEMENT, ROLE_GRANT, ROUTINE_PERMISSION, SCHEMA, SEQUENCE, STORED_PREPARED_STATEMENT, TABLE, TABLE_PERMISSION, TRIGGER, VIEW
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a warning to the activationstatic void
allocateQualArray
(Qualifier[][] qualifiers, int position, int length) Allocate an array of qualifiers and initialize in Qualifier[][]boolean
checkIfThisActivationHasHoldCursor
(String tableName) Temporary tables can be declared with ON COMMIT DELETE ROWS.protected void
checkPositionedStatement
(String cursorName, String psName) Check that a positioned statement is executing against a cursor from the same PreparedStatement (plan) that the positioned statement was original compiled against.final void
Check the validity of the current executing statement.void
clearCurrentRow
(int resultSetNumber) Clear the current row for the specified ResultSet.void
Clear the ConglomerateController to be used for an update or delete.void
Clear the info for the index to be re-used for update/delete.void
prepared statement use the same activation for multiple execution.void
Clear the activation's warnings.final void
close()
Closing an activation marks it as unusable.protected void
A generated class can create its own closeActivationAction method to invoke special logic when the activation is closed.protected abstract ResultSet
Create the ResultSet tree for this statement.(package private) ResultSet
Create the ResultSet tree for this statement, and possibly perform extra checks or initialization required by specific sub-classes.e0()
e1()
e2()
e3()
e4()
e5()
e6()
e7()
e8()
e9()
final ResultSet
execute()
When the prepared statement is executed, it passes execution on to the activation execution was requested for.int[]
Returns the column positions array of columns requested in auto-generated keys resultset for this avtivation.String[]
Returns the column names array of columns requested in auto-generated keys resultset for this avtivation.boolean
Returns true if auto-generated keys resultset request was made for this avtivation.protected Calendar
Return a calendar for use by this activation.Get the unique class id for the Dependable.protected final DataValueDescriptor
getColumnFromRow
(int rsNumber, int colId) Get the top ConstantAction on the stack without changing the stack.Get the Current ContextManager.Used to get a proxy for the current connection.getCurrentRow
(int resultSetNumber) Get the current row at the given index.getCurrentValueAndAdvance
(String sequenceUUIDstring, int typeFormatID) Called by generated code to get the next number in an ANSI/ISO sequence and advance the sequence.get the cursor name.Used in CurrentOfResultSet to get to the cursor result set for a cursor.Used by activations to generate data values.getDB2Length
(DataValueDescriptor value, int constantLength, NumberDataValue reUse) Compute the DB2 compatible length of a value.Get the TableDescriptor for the target of DDL.Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.ResultSet[][]
Real implementations of this method are provided by a generated class.final ExecutionFactory
Used in activations for generating rows.boolean
Get whether or not this activation is for create table.final GeneratedClass
getGC()
Get the GeneratedClass object for this object.Get the ConglomerateController, if any, that has already been opened for the heap when scaning for an update or delete.long
Get the conglomerate number of the index, if any, that has already been opened for scaning for an update or delete.Get the ScanController, if any, that has already been opened for the index when scaning for an update or delete.Get the language connection factory associated with this connectionint
Real implementations of this method are provided by a generated class.long
Get the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)final GeneratedMethod
(package private) static ModuleFactory
Privileged Monitor lookup.int
Get the number of subqueries in the entire query.Get the UUID of this Dependable OBJECT.Get the name of this Dependable OBJECT.protected final DataValueDescriptor
getParameter
(int position) This method can help reduce the amount of generated code by changing instances of this.pvs.getParameter(position) to this.getParameter(position)return the parameters.Get the activation of the calling statement or parent statement.getParentResultSet
(String resultSetId) get the reference to parent table ResultSets, that will be needed by the referential action dependent table scans.final ExecPreparedStatement
Get the prepared statement that this activation is for.Get the result description for this activation, if it has one.Returns the current result set for this activation, i.e.final ResultSetFactory
Used in the execute method of activations for generating the result sets that they concatenate together.boolean
Return the holdability of this activation.getRowLocationTemplate
(int itemNumber) Get the saved RowLocation.final boolean
protected DataValueDescriptor
getSetAutoincrementValue
(int columnPosition, long increment) Called by generated code to compute the next autoincrement value.Return the current SQL session context for all immediately nested connections stemming from the call or function invocation of the statement corresponding to this activation.Used in CurrentOfResultSet to get to the target result set for a cursor.Get the ResultSet for the target of an update/delete to a VTI.final TransactionController
Get the Execution TransactionController associated with this activation/lcc.Returns the chained list of warnings.void
informOfRowCount
(NoPutResultSet resultSet, long currentRowCount) Tell this activation that the given ResultSet was found to have the given number of rows.final void
initFromContext
(Context context) Initialize the generated class from a context.boolean
isClosed()
Find out if the activation closed or not.boolean
Is this Activation for a cursor?final boolean
isInUse()
Is the activation in use?boolean
Return whether or not this Dependable is persistent.boolean
Returns true if this Activation is only going to be used for one execution.boolean
isValid()
Check that all of the dependent's dependencies are valid.void
makeInvalid
(int action, LanguageConnectionContext lcc) Mark the dependent as invalid (due to at least one of its dependencies being invalid).final void
Mark the activation as unused.protected static void
nullToPrimitiveTest
(DataValueDescriptor dvd, String primitiveType) Pop the ConstantAction stack, returning the element which was just popped off the stack.void
prepareToInvalidate
(Provider p, int action, LanguageConnectionContext lcc) Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).pushConstantAction
(ConstantAction newConstantAction) Push a ConstantAction to be returned by getConstantAction().protected void
reinit()
Reinitialize data structures added by the sub-classes before each execution of the statement.static void
reinitializeQualifiers
(Qualifier[][] qualifiers) Reinitialize all Qualifiers in an array of Qualifiers.void
reset()
This is a partial implementation of reset.void
setAutoGeneratedKeysResultsetInfo
(int[] columnIndexes, String[] columnNames) Set the auto-generated keys resultset mode to true for this activation.static void
setColumnPosition
(int[] columnPositions, int positionToSet, int column) Set a column position in an array of column positions.void
setCurrentRow
(ExecRow currentRow, int resultSetNumber) Remember the row for the specified ResultSet.void
setCursorName
(String cursorName) remember the cursor namevoid
Save the TableDescriptor for the target of DDL so that it can be passed between the various ConstantActions during execution.void
Mark the Activation as being for create table.void
setForUpdateIndexScan
(CursorResultSet forUpdateIndexScan) beetle 3865: updateable cursor using index.final void
setGC
(GeneratedClass gc) Set the Generated Class.void
setHeapConglomerateController
(ConglomerateController updateHeapCC) Set the ConglomerateController to be used for an update or delete.void
setIndexConglomerateNumber
(long indexConglomerateNumber) Set the conglomerate number of the index to be used for an update or delete, when scanning an index that will also be updated (Saves opening the ScanController twice.)void
setIndexScanController
(ScanController indexSC) Set the ScanController to be used for an update or delete, when scanning an index that will also be updated (Saves opening the ScanController twice.)void
setMaxRows
(long maxRows) Set the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)void
setParameters
(ParameterValueSet parameterValues, DataTypeDescriptor[] parameterTypes) Sets the parameter values for this execution of the statement.protected final void
setParameterValueSet
(int paramCount, boolean hasReturnParam) void
This activation is created in a dynamic call context or a substatement execution context, make note of its parent statements activation (a).void
setParentResultSet
(TemporaryRowHolder rs, String resultSetId) static void
setQualifier
(Qualifier[][] qualifiers, Qualifier qualifier, int position_1, int position_2) Set a Qualifier in a 2 dimensional array of Qualifiers.void
setResultSetHoldability
(boolean resultSetHoldability) Set current resultset holdability.void
Set this Activation for a single execution.void
setTargetVTI
(ResultSet targetVTI) Save the ResultSet for the target of an update/delete to a VTI.final void
setupActivation
(ExecPreparedStatement ps, boolean scrollable) Link this activation with its PreparedStatement.setupSQLSessionContextForChildren
(boolean push) Set up and return the current SQL session context for all immediately nested connections stemming from the call or function invocation of the statement corresponding to this activation (push=true) or for a substatement, which shares the parents statement's session context (push=false).protected boolean
Find out if it's time to check the row counts of the tables involved in this query.void
throwIfClosed
(String op) Various activation methods need to disallow their invocation if the activation is closed.void
Throw an exception if any parameters are uninitialized.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.derby.iapi.services.loader.GeneratedByteCode
postConstructor
-
Field Details
-
lcc
-
cm
-
preStmt
-
resultSet
-
resultDescription
-
closed
protected boolean closed -
cursorName
-
numSubqueries
protected int numSubqueries -
singleExecution
private boolean singleExecution -
inUse
private volatile boolean inUse -
targetVTI
-
warnings
-
gc
-
checkRowCounts
private boolean checkRowCounts -
rowCountsCheckedThisExecution
-
MAX_SQRT
private static final long MAX_SQRT -
TEN_PERCENT_THRESHOLD
private static final int TEN_PERCENT_THRESHOLD- See Also:
-
updateHeapCC
-
indexSC
-
indexConglomerateNumber
private long indexConglomerateNumber -
ddlTableDescriptor
-
maxRows
private long maxRows -
forCreateTable
private boolean forCreateTable -
scrollable
private boolean scrollable -
resultSetHoldability
private boolean resultSetHoldability -
forUpdateIndexScan
-
autoGeneratedKeysResultSetMode
private boolean autoGeneratedKeysResultSetMode -
autoGeneratedKeysColumnIndexes
private int[] autoGeneratedKeysColumnIndexes -
autoGeneratedKeysColumnNames
-
isValid
private boolean isValidBy setting isValid to false, we can force a new activation to be used even if the prepared statement is still valid. This is used when modifying the current role for a session, which may (if the statement relies on privileges obtained via the current role) require rechecking of privileges. The checking normally only happens the first time the prepared statement is used in a session, when the activation is constructed. Forcing creation of a new activation achieves the purpose of getting the check performed over again and is cheaper than invalidating the prepared statement itself. Also, the latter would impact other sessions, forcing them to recreate their activations. -
UUIDString
For dependency tracking -
UUIDValue
For dependency tracking -
parentActivation
The 'parentActivation' of an activation of a statement executing in the root connection is null. A non-null 'parentActivation' represents the activation of the calling statement (if we are in a nested connection of a stored routine), or the activation of the parent statement (if we are executing a sub-statement) 'parentActivation' is set when this activation is created (@see PreparedStatement#getActivation) based on the top of the dynamic call stack of execution, which is tracked by StatementContext. The nested SQL session context is initialized by code generated for the call, after parameters are evaluated or just sub-statement execution starts.- See Also:
-
sqlSessionContextForChildren
The SQL session context to be used inside a nested connection in a stored routine or in a substatement. In the latter case, it is an alias to the superstatement's session context. -
constantActionStack
Stack of ConstantActions. -
indexOfSessionTableNamesInSavedObjects
protected int indexOfSessionTableNamesInSavedObjects -
row
-
pvs
-
raParentResultSets
-
parentResultSets
-
cal
-
-
Constructor Details
-
BaseActivation
protected BaseActivation()
-
-
Method Details
-
initFromContext
Description copied from interface:GeneratedByteCode
Initialize the generated class from a context. Called by the class manager just after creating the instance of the new class.- Specified by:
initFromContext
in interfaceGeneratedByteCode
- Throws:
StandardException
-
execute
Description copied from interface:Activation
When the prepared statement is executed, it passes execution on to the activation execution was requested for.- Specified by:
execute
in interfaceActivation
- Returns:
- the ResultSet for further manipulation, if any.
- Throws:
StandardException
- Thrown on failure
-
decorateResultSet
Create the ResultSet tree for this statement, and possibly perform extra checks or initialization required by specific sub-classes.- Returns:
- the root of the ResultSet tree for this statement
- Throws:
StandardException
-
createResultSet
Create the ResultSet tree for this statement.- Returns:
- the root of the ResultSet tree for this statement
- Throws:
StandardException
- standard error policy
-
reinit
Reinitialize data structures added by the sub-classes before each execution of the statement. The default implementation does nothing. Sub-classes should override this method if they need to perform operations before each execution.- Throws:
StandardException
-
getPreparedStatement
Description copied from interface:Activation
Get the prepared statement that this activation is for.- Specified by:
getPreparedStatement
in interfaceActivation
- Returns:
- the prepared statement this activation is for.
-
pushConstantAction
Description copied from interface:Activation
Push a ConstantAction to be returned by getConstantAction(). Returns the newConstantAction.- Specified by:
pushConstantAction
in interfaceActivation
-
popConstantAction
Description copied from interface:Activation
Pop the ConstantAction stack, returning the element which was just popped off the stack.- Specified by:
popConstantAction
in interfaceActivation
-
getConstantAction
Description copied from interface:Activation
Get the top ConstantAction on the stack without changing the stack.- Specified by:
getConstantAction
in interfaceActivation
-
checkStatementValidity
Description copied from interface:Activation
Check the validity of the current executing statement. Needs to be called after a statement has obtained the relevant table locks on the- Specified by:
checkStatementValidity
in interfaceActivation
- Throws:
StandardException
-
setupActivation
public final void setupActivation(ExecPreparedStatement ps, boolean scrollable) throws StandardException Link this activation with its PreparedStatement. It can be called with null to break the link with the PreparedStatement.- Parameters:
ps
- prepared statementscrollable
- activation for a scrollable result set- Throws:
StandardException
- standard error policy
-
getResultSet
Description copied from interface:Activation
Returns the current result set for this activation, i.e. the one returned by the last execute() call. If there has been no execute call or the activation has been reset or closed, a null is returned.- Specified by:
getResultSet
in interfaceActivation
- Returns:
- the current ResultSet of this activation.
-
getRowLocationTemplate
Get the saved RowLocation.- Specified by:
getRowLocationTemplate
in interfaceActivation
- Parameters:
itemNumber
- The saved item number.- Returns:
- A RowLocation template for the conglomerate
-
getResultDescription
Description copied from interface:Activation
Get the result description for this activation, if it has one.- Specified by:
getResultDescription
in interfaceActivation
- Returns:
- result description for this activation, if it has one; otherwise, null.
-
reset
This is a partial implementation of reset. Subclasses will want to reset information they are aware of, such as parameters.All subclasses must call super.reset() and then do their cleanup.
The execute call must set the resultSet field to be the resultSet that it has returned.
- Specified by:
reset
in interfaceActivation
- Throws:
StandardException
- on error
-
close
Closing an activation marks it as unusable. Any other requests made on it will fail. An activation should be marked closed when it is expected to not be used any longer, i.e. when the connection for it is closed, or it has suffered some sort of severe error. This should also remove it from the language connection context.- Specified by:
close
in interfaceActivation
- Throws:
StandardException
- on error
-
closeActivationAction
A generated class can create its own closeActivationAction method to invoke special logic when the activation is closed.- Throws:
Exception
- error
-
isClosed
public boolean isClosed()Find out if the activation closed or not.- Specified by:
isClosed
in interfaceActivation
- Returns:
- true if the prepared statement has been closed.
-
setSingleExecution
public void setSingleExecution()Set this Activation for a single execution.- Specified by:
setSingleExecution
in interfaceActivation
- See Also:
-
isSingleExecution
public boolean isSingleExecution()Returns true if this Activation is only going to be used for one execution.- Specified by:
isSingleExecution
in interfaceActivation
- See Also:
-
getNumSubqueries
public int getNumSubqueries()Get the number of subqueries in the entire query.- Specified by:
getNumSubqueries
in interfaceActivation
- Returns:
- int The number of subqueries in the entire query.
-
isCursorActivation
public boolean isCursorActivation()Description copied from interface:Activation
Is this Activation for a cursor?- Specified by:
isCursorActivation
in interfaceActivation
- Returns:
- Whether or not this Activation is for a cursor.
- See Also:
-
setGC
Description copied from interface:GeneratedByteCode
Set the Generated Class. Call by the class manager just after calling initFromContext.- Specified by:
setGC
in interfaceGeneratedByteCode
-
getGC
Description copied from interface:GeneratedByteCode
Get the GeneratedClass object for this object.- Specified by:
getGC
in interfaceGeneratedByteCode
-
getMethod
- Specified by:
getMethod
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e0
- Specified by:
e0
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e1
- Specified by:
e1
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e2
- Specified by:
e2
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e3
- Specified by:
e3
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e4
- Specified by:
e4
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e5
- Specified by:
e5
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e6
- Specified by:
e6
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e7
- Specified by:
e7
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e8
- Specified by:
e8
in interfaceGeneratedByteCode
- Throws:
StandardException
-
e9
- Specified by:
e9
in interfaceGeneratedByteCode
- Throws:
StandardException
-
checkIfThisActivationHasHoldCursor
Temporary tables can be declared with ON COMMIT DELETE ROWS. But if the table has a held curosr open at commit time, data should not be deleted from the table. This method, (gets called at commit time) checks if this activation held cursor and if so, does that cursor reference the passed temp table name.- Specified by:
checkIfThisActivationHasHoldCursor
in interfaceActivation
- Returns:
- true if this activation has held cursor and if it references the passed temp table name
-
setCursorName
remember the cursor name- Specified by:
setCursorName
in interfaceActivation
- Parameters:
cursorName
- The cursor name to use.
-
getCursorName
get the cursor name. For something that isn't a cursor, this is used as a string name of the result set for messages from things like the dependency manager.Activations that do support cursors will override this.
- Specified by:
getCursorName
in interfaceActivation
- Returns:
- The cursor name.
-
setResultSetHoldability
public void setResultSetHoldability(boolean resultSetHoldability) Description copied from interface:Activation
Set current resultset holdability.- Specified by:
setResultSetHoldability
in interfaceActivation
- Parameters:
resultSetHoldability
- The new resultset holdability.
-
getResultSetHoldability
public boolean getResultSetHoldability()Description copied from interface:Activation
Return the holdability of this activation.- Specified by:
getResultSetHoldability
in interfaceActivation
- Returns:
- The holdability of this activation.
-
setAutoGeneratedKeysResultsetInfo
Description copied from interface:Activation
Set the auto-generated keys resultset mode to true for this activation. The specific columns for auto-generated keys resultset can be requested by passing column positions array The specific columns for auto-generated keys resultset can be requested by passing column names array Both the parameters would be null if user didn't request specific keys. Otherwise, the user could request specific columns by passing column positions or names array but not both.- Specified by:
setAutoGeneratedKeysResultsetInfo
in interfaceActivation
- Parameters:
columnIndexes
- Request specific columns in auto-generated keys resultset by passing column positions. null means no specific columns requested by positioncolumnNames
- Request specific columns in auto-generated keys resultset by passing column names. null means no specific columns requested by position- See Also:
-
getAutoGeneratedKeysResultsetMode
public boolean getAutoGeneratedKeysResultsetMode()Description copied from interface:Activation
Returns true if auto-generated keys resultset request was made for this avtivation.- Specified by:
getAutoGeneratedKeysResultsetMode
in interfaceActivation
- Returns:
- auto-generated keys resultset mode for this activation.
- See Also:
-
getAutoGeneratedKeysColumnIndexes
public int[] getAutoGeneratedKeysColumnIndexes()Description copied from interface:Activation
Returns the column positions array of columns requested in auto-generated keys resultset for this avtivation. Returns null if no specific column requested by positions- Specified by:
getAutoGeneratedKeysColumnIndexes
in interfaceActivation
- Returns:
- column positions array of columns requested.
- See Also:
-
getAutoGeneratedKeysColumnNames
Description copied from interface:Activation
Returns the column names array of columns requested in auto-generated keys resultset for this avtivation. Returns null if no specific column requested by names- Specified by:
getAutoGeneratedKeysColumnNames
in interfaceActivation
- Returns:
- column names array of columns requested.
- See Also:
-
getResultSetFactory
Used in the execute method of activations for generating the result sets that they concatenate together. -
getExecutionFactory
Used in activations for generating rows.- Specified by:
getExecutionFactory
in interfaceActivation
- Returns:
- ExecutionFactory
-
getTargetResultSet
Used in CurrentOfResultSet to get to the target result set for a cursor. Overridden by activations generated for updatable cursors. Those activations capture the target result set in a field in their execute() method, and then return the value of that field in their version of this method.- Specified by:
getTargetResultSet
in interfaceCursorActivation
- Returns:
- null.
-
getSetAutoincrementValue
protected DataValueDescriptor getSetAutoincrementValue(int columnPosition, long increment) throws StandardException Called by generated code to compute the next autoincrement value.- Returns:
- The next autoincrement value which should be inserted. returns the correct number datatype.
- Throws:
StandardException
-
getCurrentValueAndAdvance
public NumberDataValue getCurrentValueAndAdvance(String sequenceUUIDstring, int typeFormatID) throws StandardException Called by generated code to get the next number in an ANSI/ISO sequence and advance the sequence. Raises an exception if the sequence was declared NO CYCLE and its range is exhausted.- Specified by:
getCurrentValueAndAdvance
in interfaceActivation
- Parameters:
sequenceUUIDstring
- The string value of the sequence's UUIDtypeFormatID
- The format id of the data type to be returned. E.g., StoredFormatIds.SQL_INTEGER_ID.- Returns:
- The next number in the sequence
- Throws:
StandardException
-
getCursorResultSet
Used in CurrentOfResultSet to get to the cursor result set for a cursor. Overridden by activations generated for updatable cursors. Those activations capture the cursor result set in a field in their execute() method, and then return the value of that field in their version of this method.- Specified by:
getCursorResultSet
in interfaceCursorActivation
- Returns:
- null
-
throwIfClosed
Various activation methods need to disallow their invocation if the activation is closed. This lets them check and throw without generating alot of code.The code to write to generate the call to this is approximately:
// jf is a JavaFactory CallableExpression ce = jf.newMethodCall( jf.thisExpression(), BaseActivation.CLASS_NAME, "throwIfClosed", "void", acb.exprArray(jf.newStringLiteral(...some literal here...))); //mb is a MethodBuilder mb.addStatement(jf.newStatement(ce)); The java code to write to call this is:this.throwIfClosed(...some literal here...); In both cases, "...some literal here..." gets replaced with an expression of type String that evaluates to the name of the operation that is being checked, like "execute" or "reset".- Throws:
StandardException
- thrown if closed
-
setColumnPosition
public static void setColumnPosition(int[] columnPositions, int positionToSet, int column) Set a column position in an array of column positions.- Parameters:
columnPositions
- The array of column positionspositionToSet
- The place to put the column positioncolumn
- The column position
-
allocateQualArray
Allocate an array of qualifiers and initialize in Qualifier[][]- Parameters:
qualifiers
- The array of Qualifier arrays.position
- The position in the array to setlength
- The array length of the qualifier array to allocate.
-
setQualifier
public static void setQualifier(Qualifier[][] qualifiers, Qualifier qualifier, int position_1, int position_2) Set a Qualifier in a 2 dimensional array of Qualifiers. Set a single Qualifier into one slot of a 2 dimensional array of Qualifiers. @see Qualifier for detailed description of layout of the 2-d array.- Parameters:
qualifiers
- The array of Qualifiersqualifier
- The Qualifierposition_1
- The Nth array index into qualifiers[N][M]position_2
- The Nth array index into qualifiers[N][M]
-
reinitializeQualifiers
Reinitialize all Qualifiers in an array of Qualifiers.- Parameters:
qualifiers
- The array of Qualifiers
-
markUnused
public final void markUnused()Mark the activation as unused.- Specified by:
markUnused
in interfaceActivation
-
isInUse
public final boolean isInUse()Is the activation in use?- Specified by:
isInUse
in interfaceActivation
- Returns:
- true/false
-
addWarning
Description copied from interface:Activation
Add a warning to the activation- Specified by:
addWarning
in interfaceActivation
- See Also:
-
getWarnings
Description copied from interface:Activation
Returns the chained list of warnings. Returns null if there are no warnings.- Specified by:
getWarnings
in interfaceActivation
- See Also:
-
clearWarnings
public void clearWarnings()Description copied from interface:Activation
Clear the activation's warnings.- Specified by:
clearWarnings
in interfaceActivation
- See Also:
-
nullToPrimitiveTest
protected static void nullToPrimitiveTest(DataValueDescriptor dvd, String primitiveType) throws StandardException - Throws:
StandardException
- on error
-
informOfRowCount
public void informOfRowCount(NoPutResultSet resultSet, long currentRowCount) throws StandardException Description copied from interface:Activation
Tell this activation that the given ResultSet was found to have the given number of rows. This is used during execution to determine whether a table has grown or shrunk. If a table's size changes significantly, the activation may invalidate its PreparedStatement to force recompilation. Note that the association of row counts with ResultSets is kept in the activation class, not in the activation itself. This means that this method must be synchronized. This method is not required to check the number of rows on each call. Because of synchronization, this check is likely to be expensive, so it may only check every hundred calls or so.- Specified by:
informOfRowCount
in interfaceActivation
- Throws:
StandardException
- Thrown on error- See Also:
-
getHeapConglomerateController
Description copied from interface:Activation
Get the ConglomerateController, if any, that has already been opened for the heap when scaning for an update or delete. (Saves opening the ConglomerateController twice.)- Specified by:
getHeapConglomerateController
in interfaceActivation
- Returns:
- The ConglomerateController, if available, to use for the update.
- See Also:
-
setHeapConglomerateController
Description copied from interface:Activation
Set the ConglomerateController to be used for an update or delete. (Saves opening the ConglomerateController twice.)- Specified by:
setHeapConglomerateController
in interfaceActivation
- Parameters:
updateHeapCC
- The ConglomerateController to reuse for the update or delete.- See Also:
-
clearHeapConglomerateController
public void clearHeapConglomerateController()Description copied from interface:Activation
Clear the ConglomerateController to be used for an update or delete. (Saves opening the ConglomerateController twice.)- Specified by:
clearHeapConglomerateController
in interfaceActivation
- See Also:
-
getIndexScanController
Description copied from interface:Activation
Get the ScanController, if any, that has already been opened for the index when scaning for an update or delete. (Saves opening the ScanController twice.)- Specified by:
getIndexScanController
in interfaceActivation
- Returns:
- The ScanController, if available, to use for the update.
- See Also:
-
setIndexScanController
Description copied from interface:Activation
Set the ScanController to be used for an update or delete, when scanning an index that will also be updated (Saves opening the ScanController twice.)- Specified by:
setIndexScanController
in interfaceActivation
- Parameters:
indexSC
- The ScanController to reuse for the update or delete.- See Also:
-
getIndexConglomerateNumber
public long getIndexConglomerateNumber()Description copied from interface:Activation
Get the conglomerate number of the index, if any, that has already been opened for scaning for an update or delete. (Saves opening the ScanController twice.)- Specified by:
getIndexConglomerateNumber
in interfaceActivation
- Returns:
- The conglomerate number, if available, to use for the update.
- See Also:
-
setIndexConglomerateNumber
public void setIndexConglomerateNumber(long indexConglomerateNumber) Description copied from interface:Activation
Set the conglomerate number of the index to be used for an update or delete, when scanning an index that will also be updated (Saves opening the ScanController twice.)- Specified by:
setIndexConglomerateNumber
in interfaceActivation
- Parameters:
indexConglomerateNumber
- The conglomerate number of the index to reuse for the update or delete.- See Also:
-
clearIndexScanInfo
public void clearIndexScanInfo()Description copied from interface:Activation
Clear the info for the index to be re-used for update/delete. (ScanController and conglomerate number.)- Specified by:
clearIndexScanInfo
in interfaceActivation
- See Also:
-
setForCreateTable
public void setForCreateTable()Description copied from interface:Activation
Mark the Activation as being for create table. (NOTE: We can do certain optimizations for create table that we can't do for other DDL.)- Specified by:
setForCreateTable
in interfaceActivation
- See Also:
-
getForCreateTable
public boolean getForCreateTable()Description copied from interface:Activation
Get whether or not this activation is for create table. (NOTE: We can do certain optimizations for create table that we can't do for other DDL.)- Specified by:
getForCreateTable
in interfaceActivation
- Returns:
- Whether or not this activation is for create table.
- See Also:
-
setDDLTableDescriptor
Description copied from interface:Activation
Save the TableDescriptor for the target of DDL so that it can be passed between the various ConstantActions during execution.- Specified by:
setDDLTableDescriptor
in interfaceActivation
- See Also:
-
getDDLTableDescriptor
Description copied from interface:Activation
Get the TableDescriptor for the target of DDL.- Specified by:
getDDLTableDescriptor
in interfaceActivation
- Returns:
- The TableDescriptor for the target of DDL.
- See Also:
-
setMaxRows
public void setMaxRows(long maxRows) Description copied from interface:Activation
Set the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)- Specified by:
setMaxRows
in interfaceActivation
- Parameters:
maxRows
- Maximum # of rows. (0 means no limit.)- See Also:
-
getMaxRows
public long getMaxRows()Description copied from interface:Activation
Get the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)- Specified by:
getMaxRows
in interfaceActivation
- Returns:
- Maximum # of rows. (0 means no limit.)
- See Also:
-
setTargetVTI
Description copied from interface:Activation
Save the ResultSet for the target of an update/delete to a VTI.- Specified by:
setTargetVTI
in interfaceActivation
-
getTargetVTI
Description copied from interface:Activation
Get the ResultSet for the target of an update/delete to a VTI.- Specified by:
getTargetVTI
in interfaceActivation
- Returns:
- The ResultSet for the target of an update/delete to a VTI.
-
shouldWeCheckRowCounts
Find out if it's time to check the row counts of the tables involved in this query.- Returns:
- true if the row counts should be checked, false otherwise
- Throws:
StandardException
-
getScrollable
public final boolean getScrollable() -
setParameterValueSet
protected final void setParameterValueSet(int paramCount, boolean hasReturnParam) -
getParameter
This method can help reduce the amount of generated code by changing instances of this.pvs.getParameter(position) to this.getParameter(position)- Parameters:
position
-- Throws:
StandardException
-
getParameterValueSet
return the parameters.- Specified by:
getParameterValueSet
in interfaceActivation
- Returns:
- The ParameterValueSet for this execution of the statement. Returns NULL if there are no parameters.
-
setParameters
public void setParameters(ParameterValueSet parameterValues, DataTypeDescriptor[] parameterTypes) throws StandardException Description copied from interface:Activation
Sets the parameter values for this execution of the statement.Has no effect if the activation has been closed.
NOTE: The setParameters() method is currently unimplemented. A statement with parameters will generate its own ParameterValueSet, which can be gotten with the getParameterValueSet() method (above). The idea behind setParameters() is to improve performance when operating across a network by allowing all the parameters to be set in one call, as opposed to one call per parameter.
- Specified by:
setParameters
in interfaceActivation
- Parameters:
parameterValues
- The values of the parameters.- Throws:
StandardException
-
throwIfMissingParms
Throw an exception if any parameters are uninitialized.- Throws:
StandardException
- Thrown if any parameters are unitialized
-
setCurrentRow
Remember the row for the specified ResultSet.- Specified by:
setCurrentRow
in interfaceActivation
- Parameters:
currentRow
- The row to be operated upon.resultSetNumber
- The resultSetNumber for the current ResultSet
-
clearCurrentRow
public void clearCurrentRow(int resultSetNumber) Clear the current row for the specified ResultSet.- Specified by:
clearCurrentRow
in interfaceActivation
- Parameters:
resultSetNumber
- The resultSetNumber for the current ResultSet
-
getCurrentRow
Get the current row at the given index.- Specified by:
getCurrentRow
in interfaceActivation
-
getSQLSessionContextForChildren
Return the current SQL session context for all immediately nested connections stemming from the call or function invocation of the statement corresponding to this activation. Substatements (e.g. used in rs.updateRow), inherit the SQL session context via its parent activation.- Specified by:
getSQLSessionContextForChildren
in interfaceActivation
- See Also:
-
setupSQLSessionContextForChildren
Description copied from interface:Activation
Set up and return the current SQL session context for all immediately nested connections stemming from the call or function invocation of the statement corresponding to this activation (push=true) or for a substatement, which shares the parents statement's session context (push=false).- Specified by:
setupSQLSessionContextForChildren
in interfaceActivation
- Parameters:
push
- true if used to push a new connection context- See Also:
-
setParentActivation
This activation is created in a dynamic call context or a substatement execution context, make note of its parent statements activation (a).- Specified by:
setParentActivation
in interfaceActivation
- Parameters:
a
- The caller's or superstatement's activation
-
getParentActivation
Get the activation of the calling statement or parent statement.- Specified by:
getParentActivation
in interfaceActivation
- Returns:
- The parent's activation
-
getColumnFromRow
protected final DataValueDescriptor getColumnFromRow(int rsNumber, int colId) throws StandardException - Throws:
StandardException
-
checkPositionedStatement
Check that a positioned statement is executing against a cursor from the same PreparedStatement (plan) that the positioned statement was original compiled against. Only called from generated code for positioned UPDATE and DELETE statements. See CurrentOfNode.- Parameters:
cursorName
- Name of the cursorpsName
- Object name of the PreparedStatement.- Throws:
StandardException
-
materializeResultSetIfPossible
- Throws:
StandardException
-
setParentResultSet
- Specified by:
setParentResultSet
in interfaceActivation
-
getParentResultSet
get the reference to parent table ResultSets, that will be needed by the referential action dependent table scans.- Specified by:
getParentResultSet
in interfaceActivation
-
getParentResultSetKeys
- Specified by:
getParentResultSetKeys
in interfaceActivation
-
clearParentResultSets
public void clearParentResultSets()prepared statement use the same activation for multiple execution. For each excution we create new set of temporary resultsets, we should clear this hash table. otherwise we will refer to the released resources.- Specified by:
clearParentResultSets
in interfaceActivation
-
setForUpdateIndexScan
beetle 3865: updateable cursor using index. A way of communication between cursor activation and update activation.- Specified by:
setForUpdateIndexScan
in interfaceActivation
-
getForUpdateIndexScan
- Specified by:
getForUpdateIndexScan
in interfaceActivation
-
getCalendar
Return a calendar for use by this activation. Calendar objects are not thread safe, the one returned is purely for use by this activation and it is assumed that is it single threded through the single active thread in a connection model. -
getLanguageConnectionContext
Get the language connection factory associated with this connection- Specified by:
getLanguageConnectionContext
in interfaceActivation
-
getTransactionController
Description copied from interface:Activation
Get the Execution TransactionController associated with this activation/lcc.- Specified by:
getTransactionController
in interfaceActivation
-
getContextManager
Get the Current ContextManager.- Returns:
- Current ContextManager
-
getDataValueFactory
Used by activations to generate data values. Most DML statements will use this method. Possibly some DDL statements will, as well.- Specified by:
getDataValueFactory
in interfaceActivation
- Returns:
- DataValueFactory
-
getCurrentConnection
Used to get a proxy for the current connection.- Throws:
SQLException
- Thrown on failure to get connection
-
getDynamicResults
Real implementations of this method are provided by a generated class.- Specified by:
getDynamicResults
in interfaceActivation
- Returns:
- null if no dynamic results exists. Otherwise an array of ResultSet arrays, each of length one containing null or a reference to a ResultSet.
-
getMaxDynamicResults
public int getMaxDynamicResults()Real implementations of this method are provided by a generated class.- Specified by:
getMaxDynamicResults
in interfaceActivation
-
getDB2Length
public NumberDataValue getDB2Length(DataValueDescriptor value, int constantLength, NumberDataValue reUse) throws StandardException Compute the DB2 compatible length of a value.- Parameters:
value
-constantLength
- The length, if it is a constant modulo null/not null. -1 if the length is not constantreUse
- If non-null then re-use this as a container for the length- Returns:
- the DB2 compatible length, set to null if value is null.
- Throws:
StandardException
-
getDependableFinder
Description copied from interface:Dependable
Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.- Specified by:
getDependableFinder
in interfaceDependable
- Returns:
- A Finder object that can be written to disk if this is a Persistent Dependable. Null if this is not a persistent dependable.
- See Also:
-
getObjectName
Description copied from interface:Dependable
Get the name of this Dependable OBJECT. This is useful for diagnostic messages.- Specified by:
getObjectName
in interfaceDependable
- Returns:
- Name of Dependable OBJECT.
- See Also:
-
getObjectID
Description copied from interface:Dependable
Get the UUID of this Dependable OBJECT.- Specified by:
getObjectID
in interfaceDependable
- Returns:
- UUID of this OBJECT.
- See Also:
-
getClassType
Description copied from interface:Dependable
Get the unique class id for the Dependable. Every Dependable belongs to a class of Dependables.- Specified by:
getClassType
in interfaceDependable
- Returns:
- type of this Dependable.
- See Also:
-
isPersistent
public boolean isPersistent()Description copied from interface:Dependable
Return whether or not this Dependable is persistent. Persistent dependencies are stored in SYS.SYSDEPENDS.- Specified by:
isPersistent
in interfaceDependable
- Returns:
- true if this Dependable is persistent.
- See Also:
-
isValid
public boolean isValid()Description copied from interface:Dependent
Check that all of the dependent's dependencies are valid. -
makeInvalid
Description copied from interface:Dependent
Mark the dependent as invalid (due to at least one of its dependencies being invalid).- Specified by:
makeInvalid
in interfaceDependent
- Parameters:
action
- The action causing the invalidationlcc
- The LanguageConnectionContext- Throws:
StandardException
- thrown if unable to make it invalid- See Also:
-
prepareToInvalidate
public void prepareToInvalidate(Provider p, int action, LanguageConnectionContext lcc) throws StandardException Description copied from interface:Dependent
Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).- Specified by:
prepareToInvalidate
in interfaceDependent
- Parameters:
p
- the provideraction
- The action causing the invalidationlcc
- The LanguageConnectionContext- Throws:
StandardException
- thrown if unable to make it invalid- See Also:
-
getMonitor
Privileged Monitor lookup. Must be package private so that user code can't call this entry point.
-