Class GenericActivationHolder
- java.lang.Object
-
- org.apache.derby.impl.sql.GenericActivationHolder
-
- All Implemented Interfaces:
Dependable
,Activation
,Dependent
public final class GenericActivationHolder extends java.lang.Object implements Activation
This class holds an Activation, and passes through most of the calls to the activation. The purpose of this class is to allow a PreparedStatement to be recompiled without the caller having to detect this and get a new activation. In addition to the Activation, this class holds a reference to the PreparedStatement that created it, along with a reference to the GeneratedClass that was associated with the PreparedStatement at the time this holder was created. These references are used to validate the Activation, to ensure that an activation is used only with the PreparedStatement that created it, and to detect when recompilation has happened. We detect recompilation by checking whether the GeneratedClass has changed. If it has, we try to let the caller continue to use this ActivationHolder. We create a new instance of the new GeneratedClass (that is, we create a new Activation), and we compare the number and type of parameters. If these are compatible, we copy the parameters from the old to the new Activation. If they are not compatible, we throw an exception telling the user that the Activation is out of date, and they need to get a new one.
-
-
Field Summary
Fields Modifier and Type Field Description BaseActivation
ac
(package private) GeneratedClass
gc
private LanguageConnectionContext
lcc
(package private) DataTypeDescriptor[]
paramTypes
(package private) ExecPreparedStatement
ps
-
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 Constructor Description GenericActivationHolder(LanguageConnectionContext lcc, GeneratedClass gc, ExecPreparedStatement ps, boolean scrollable)
Constructor for an ActivationHolder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWarning(java.sql.SQLWarning w)
Add a warning to the activationboolean
checkIfThisActivationHasHoldCursor(java.lang.String tableName)
Temporary tables can be declared with ON COMMIT DELETE ROWS.void
checkStatementValidity()
Check the validity of the current executing statement.void
clearCurrentRow(int resultSetNumber)
Generated plans have a current row field for ease in defining the methods and finding them dynamically.void
clearHeapConglomerateController()
Clear the ConglomerateController to be used for an update or delete.void
clearIndexScanInfo()
Clear the info for the index to be re-used for update/delete.void
clearParentResultSets()
void
clearWarnings()
Clear the activation's warnings.void
close()
Closing an activation statement marks it as unusable.ResultSet
execute()
When the prepared statement is executed, it passes execution on to the activation execution was requested for.int[]
getAutoGeneratedKeysColumnIndexes()
Returns the column positions array of columns requested in auto-generated keys resultset for this avtivation.java.lang.String[]
getAutoGeneratedKeysColumnNames()
Returns the column names array of columns requested in auto-generated keys resultset for this avtivation.boolean
getAutoGeneratedKeysResultsetMode()
Returns true if auto-generated keys resultset request was made for this avtivation.java.lang.String
getClassType()
Get the unique class id for the Dependable.ConstantAction
getConstantAction()
Get the top ConstantAction on the stack without changing the stack.Row
getCurrentRow(int resultSetNumber)
Get the current row at the given index.NumberDataValue
getCurrentValueAndAdvance(java.lang.String sequenceUUIDstring, int typeFormatID)
Called by generated code to get the next number in an ANSI/ISO sequence and advance the sequence.java.lang.String
getCursorName()
Return the cursor name of this activation.DataValueFactory
getDataValueFactory()
Get the DataValueFactoryTableDescriptor
getDDLTableDescriptor()
Get the TableDescriptor for the target of DDL.DependableFinder
getDependableFinder()
Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.java.sql.ResultSet[][]
getDynamicResults()
Return the set of dynamical created result sets, for procedures.ExecutionFactory
getExecutionFactory()
Get the ExecutionFactoryboolean
getForCreateTable()
Get whether or not this activation is for create table.CursorResultSet
getForUpdateIndexScan()
ConglomerateController
getHeapConglomerateController()
Get the ConglomerateController, if any, that has already been opened for the heap when scaning for an update or delete.long
getIndexConglomerateNumber()
Get the conglomerate number of the index, if any, that has already been opened for scaning for an update or delete.ScanController
getIndexScanController()
Get the ScanController, if any, that has already been opened for the index when scaning for an update or delete.LanguageConnectionContext
getLanguageConnectionContext()
Get the language connection context associated with this activationint
getMaxDynamicResults()
Return the maximum number of dynamical created result sets from the procedure definition.long
getMaxRows()
Get the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)int
getNumSubqueries()
Get the number of subqueries in the entire query.UUID
getObjectID()
Get the UUID of this Dependable OBJECT.java.lang.String
getObjectName()
Get the name of this Dependable OBJECT.ParameterValueSet
getParameterValueSet()
Gets the ParameterValueSet for this execution of the statement.Activation
getParentActivation()
This activation is created in a dynamic call context, or substatement execution context; get its caller's or superstatement's activation.java.util.Vector<TemporaryRowHolder>
getParentResultSet(java.lang.String resultSetId)
get the reference to parent table ResultSets, that will be needed by the referential action dependent table scans.java.util.Enumeration<java.lang.String>
getParentResultSetKeys()
ExecPreparedStatement
getPreparedStatement()
Get the prepared statement that this activation is for.ResultDescription
getResultDescription()
Get the result description for this activation, if it has one.ResultSet
getResultSet()
Returns the current result set for this activation, i.e.boolean
getResultSetHoldability()
Return the holdability of this activation.RowLocation
getRowLocationTemplate(int itemNumber)
Get the saved RowLocation.SQLSessionContext
getSQLSessionContextForChildren()
Get the current SQL session context if in a nested connection of a stored routine or in a substatement.java.sql.ResultSet
getTargetVTI()
Get the ResultSet for the target of an update/delete to a VTI.TransactionController
getTransactionController()
Get the Execution TransactionController associated with this activation/lcc.java.sql.SQLWarning
getWarnings()
Returns the chained list of warnings.void
informOfRowCount(NoPutResultSet resultSet, long rowCount)
Tell this activation that the given ResultSet was found to have the given number of rows.boolean
isClosed()
Find out if the activation is closed or not.boolean
isCursorActivation()
Is this Activation for a cursor?boolean
isInUse()
Is the activation in use?boolean
isPersistent()
Return whether or not this Dependable is persistent.boolean
isSingleExecution()
Is the activation set up for a single 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).void
markUnused()
Mark the activation as unused.ConstantAction
popConstantAction()
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).ConstantAction
pushConstantAction(ConstantAction newConstantAction)
Push a ConstantAction to be returned by getConstantAction().void
reset()
Resets the activation to the "pre-execution" state - that is, the state where it can be used to begin a new execution.void
setAutoGeneratedKeysResultsetInfo(int[] columnIndexes, java.lang.String[] columnNames)
Set the auto-generated keys resultset mode to true for this activation.void
setCurrentRow(ExecRow currentRow, int resultSetNumber)
Generated plans have a current row field for ease in defining the methods and finding them dynamically.void
setCursorName(java.lang.String cursorName)
JDBC requires that all select statements be converted into cursors, and that the cursor name be settable for each execution of a select statement.void
setDDLTableDescriptor(TableDescriptor td)
Save the TableDescriptor for the target of DDL so that it can be passed between the various ConstantActions during execution.void
setForCreateTable()
Mark the Activation as being for create table.void
setForUpdateIndexScan(CursorResultSet forUpdateResultSet)
beetle 3865: updateable cursor using index.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.void
setParentActivation(Activation a)
This activation is created in a dynamic call context or a substatement execution context, chain its parent statements activation..void
setParentResultSet(TemporaryRowHolder rs, java.lang.String resultSetId)
void
setResultSetHoldability(boolean resultSetHoldability)
Set current resultset holdability.void
setSingleExecution()
Set the activation for a single execution.void
setTargetVTI(java.sql.ResultSet targetVTI)
Save the ResultSet for the target of an update/delete to a VTI.SQLSessionContext
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).
-
-
-
Field Detail
-
ac
public BaseActivation ac
-
ps
ExecPreparedStatement ps
-
gc
GeneratedClass gc
-
paramTypes
DataTypeDescriptor[] paramTypes
-
lcc
private final LanguageConnectionContext lcc
-
-
Constructor Detail
-
GenericActivationHolder
GenericActivationHolder(LanguageConnectionContext lcc, GeneratedClass gc, ExecPreparedStatement ps, boolean scrollable) throws StandardException
Constructor for an ActivationHolder- Parameters:
gc
- The GeneratedClass of the Activationps
- The PreparedStatement this ActivationHolder is associated with- Throws:
StandardException
- Thrown on error
-
-
Method Detail
-
reset
public void reset() throws StandardException
Description copied from interface:Activation
Resets the activation to the "pre-execution" state - that is, the state where it can be used to begin a new execution. Frees local buffers, stops scans, resets counters to zero, sets current date and time to an unitialized state, etc.- Specified by:
reset
in interfaceActivation
- Throws:
StandardException
- thrown on failure- See Also:
Activation.reset()
-
checkIfThisActivationHasHoldCursor
public boolean checkIfThisActivationHasHoldCursor(java.lang.String tableName)
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
public void setCursorName(java.lang.String cursorName)
Description copied from interface:Activation
JDBC requires that all select statements be converted into cursors, and that the cursor name be settable for each execution of a select statement. The Language Module will support this, so that the JDBC driver will not have to parse JSQL text. This method will have no effect when called on non-select statements.There will be a JSQL statement to disable the "cursorization" of all select statements. For non-cursorized select statements, this method will have no effect.
This has no effect if the activation has been closed.
- Specified by:
setCursorName
in interfaceActivation
- Parameters:
cursorName
- The cursor name to use.- See Also:
Activation.setCursorName(java.lang.String)
-
getCursorName
public java.lang.String getCursorName()
Description copied from interface:Activation
Return the cursor name of this activation. This will differ from its ResultSet's cursor name if it has been altered with setCursorName. Thus this always returns the cursor name of the next execution of this activation. The cursor name of the current execution must be obtained from the ResultSet. or this.getResultSet.getCursorName() [with null checking].Statements that do not support cursors will return a null.
- Specified by:
getCursorName
in interfaceActivation
- Returns:
- The cursor name.
- See Also:
Activation.getCursorName()
-
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.- See Also:
Activation.setResultSetHoldability(boolean)
-
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.
- See Also:
Activation.getResultSetHoldability()
-
setAutoGeneratedKeysResultsetInfo
public void setAutoGeneratedKeysResultsetInfo(int[] columnIndexes, java.lang.String[] columnNames)
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:
Activation.setAutoGeneratedKeysResultsetInfo(int[], java.lang.String[])
-
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:
Activation.getAutoGeneratedKeysResultsetMode()
-
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:
Activation.getAutoGeneratedKeysColumnIndexes()
-
getAutoGeneratedKeysColumnNames
public java.lang.String[] 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:
Activation.getAutoGeneratedKeysColumnNames()
-
getLanguageConnectionContext
public LanguageConnectionContext getLanguageConnectionContext()
Description copied from interface:Activation
Get the language connection context associated with this activation- Specified by:
getLanguageConnectionContext
in interfaceActivation
- See Also:
Activation.getLanguageConnectionContext()
-
getTransactionController
public TransactionController getTransactionController()
Description copied from interface:Activation
Get the Execution TransactionController associated with this activation/lcc.- Specified by:
getTransactionController
in interfaceActivation
-
getExecutionFactory
public ExecutionFactory getExecutionFactory()
Description copied from interface:Activation
Get the ExecutionFactory- Specified by:
getExecutionFactory
in interfaceActivation
- Returns:
- ExecutionFactory
- See Also:
Activation.getExecutionFactory()
-
getParameterValueSet
public ParameterValueSet getParameterValueSet()
Description copied from interface:Activation
Gets the ParameterValueSet for this execution of the statement.- Specified by:
getParameterValueSet
in interfaceActivation
- Returns:
- The ParameterValueSet for this execution of the statement. Returns NULL if there are no parameters.
- See Also:
Activation.getParameterValueSet()
-
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
- See Also:
Activation.setParameters(org.apache.derby.iapi.sql.ParameterValueSet, org.apache.derby.iapi.types.DataTypeDescriptor[])
-
execute
public ResultSet execute() throws StandardException
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- See Also:
Activation.execute()
-
getResultSet
public ResultSet 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.
- See Also:
Activation.getResultSet()
-
setCurrentRow
public void setCurrentRow(ExecRow currentRow, int resultSetNumber)
Description copied from interface:Activation
Generated plans have a current row field for ease in defining the methods and finding them dynamically. The interface is used to set the row before a dynamic method that uses it is invoked.When all processing on the currentRow has been completed, callers should call activation.clearCurrentRow(resultSetNumber) to ensure that no unnecessary references are retained to rows. This will allow the rows no longer in use to be collected by the garbage collecter.
- Specified by:
setCurrentRow
in interfaceActivation
- Parameters:
currentRow
- The row to be operated upon.resultSetNumber
- The resultSetNumber for the current ResultSet- See Also:
Activation.setCurrentRow(org.apache.derby.iapi.sql.execute.ExecRow, int)
-
getCurrentRow
public Row getCurrentRow(int resultSetNumber)
Description copied from interface:Activation
Get the current row at the given index.- Specified by:
getCurrentRow
in interfaceActivation
- See Also:
Activation.getCurrentRow(int)
-
clearCurrentRow
public void clearCurrentRow(int resultSetNumber)
Description copied from interface:Activation
Generated plans have a current row field for ease in defining the methods and finding them dynamically. The interface is used to set the row before a dynamic method that uses it is invoked.When all processing on the currentRow has been completed, callers should call activation.clearCurrentRow(resultSetNumber) to ensure that no unnecessary references are retained to rows. This will allow the rows no longer in use to be collected by the garbage collecter.
- Specified by:
clearCurrentRow
in interfaceActivation
- Parameters:
resultSetNumber
- The resultSetNumber for the current ResultSet- See Also:
Activation.clearCurrentRow(int)
-
getPreparedStatement
public ExecPreparedStatement 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.
- See Also:
Activation.getPreparedStatement()
-
checkStatementValidity
public void checkStatementValidity() throws StandardException
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
-
getResultDescription
public ResultDescription 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.
- See Also:
Activation.getResultDescription()
-
getDataValueFactory
public DataValueFactory getDataValueFactory()
Description copied from interface:Activation
Get the DataValueFactory- Specified by:
getDataValueFactory
in interfaceActivation
- Returns:
- DataValueFactory
- See Also:
Activation.getDataValueFactory()
-
getRowLocationTemplate
public RowLocation getRowLocationTemplate(int itemNumber)
Description copied from interface:Activation
Get the saved RowLocation.- Specified by:
getRowLocationTemplate
in interfaceActivation
- Parameters:
itemNumber
- The saved item number.- Returns:
- A RowLocation template for the conglomerate
- See Also:
Activation.getRowLocationTemplate(int)
-
getHeapConglomerateController
public ConglomerateController 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:
Activation.getHeapConglomerateController()
-
setHeapConglomerateController
public void setHeapConglomerateController(ConglomerateController updateHeapCC)
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:
Activation.setHeapConglomerateController(org.apache.derby.iapi.store.access.ConglomerateController)
-
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:
Activation.clearHeapConglomerateController()
-
getIndexScanController
public ScanController 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:
Activation.getIndexScanController()
-
setIndexScanController
public void setIndexScanController(ScanController indexSC)
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:
Activation.setIndexScanController(org.apache.derby.iapi.store.access.ScanController)
-
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:
Activation.getIndexConglomerateNumber()
-
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:
Activation.setIndexConglomerateNumber(long)
-
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:
Activation.clearIndexScanInfo()
-
close
public void close() throws StandardException
Description copied from interface:Activation
Closing an activation statement 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 will also close its result set and release any resources it holds e.g. for parameters.Any class that implements this must be prepared to be executed from garbage collection, ie. there is no matching context stack.
- Specified by:
close
in interfaceActivation
- Throws:
StandardException
- Thrown on error- See Also:
Activation.close()
-
isClosed
public boolean isClosed()
Description copied from interface:Activation
Find out if the activation is closed or not.- Specified by:
isClosed
in interfaceActivation
- Returns:
- true if the Activation has been closed.
- See Also:
Activation.isClosed()
-
setSingleExecution
public void setSingleExecution()
Set the activation for a single execution.- Specified by:
setSingleExecution
in interfaceActivation
- See Also:
Activation.setSingleExecution()
-
isSingleExecution
public boolean isSingleExecution()
Is the activation set up for a single execution.- Specified by:
isSingleExecution
in interfaceActivation
- See Also:
Activation.isSingleExecution()
-
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.
-
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:
Activation.setForCreateTable()
-
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:
Activation.getForCreateTable()
-
setDDLTableDescriptor
public void setDDLTableDescriptor(TableDescriptor td)
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:
Activation.setDDLTableDescriptor(org.apache.derby.iapi.sql.dictionary.TableDescriptor)
-
getDDLTableDescriptor
public TableDescriptor 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:
Activation.getDDLTableDescriptor()
-
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:
Activation.setMaxRows(long)
-
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:
Activation.getMaxRows()
-
setTargetVTI
public void setTargetVTI(java.sql.ResultSet targetVTI)
Description copied from interface:Activation
Save the ResultSet for the target of an update/delete to a VTI.- Specified by:
setTargetVTI
in interfaceActivation
-
getTargetVTI
public java.sql.ResultSet 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.
-
getSQLSessionContextForChildren
public SQLSessionContext getSQLSessionContextForChildren()
Description copied from interface:Activation
Get the current SQL session context if in a nested connection of a stored routine or in a substatement.- Specified by:
getSQLSessionContextForChildren
in interfaceActivation
-
setupSQLSessionContextForChildren
public SQLSessionContext setupSQLSessionContextForChildren(boolean push)
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
-
setParentActivation
public void setParentActivation(Activation a)
Description copied from interface:Activation
This activation is created in a dynamic call context or a substatement execution context, chain its parent statements activation..- Specified by:
setParentActivation
in interfaceActivation
-
getParentActivation
public Activation getParentActivation()
Description copied from interface:Activation
This activation is created in a dynamic call context, or substatement execution context; get its caller's or superstatement's activation.- Specified by:
getParentActivation
in interfaceActivation
- Returns:
- The caller's activation
-
getDependableFinder
public DependableFinder 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:
Dependable.getDependableFinder()
-
getObjectName
public java.lang.String 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:
Dependable.getObjectName()
-
getObjectID
public UUID 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:
Dependable.getObjectID()
-
getClassType
public java.lang.String 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:
Dependable.getClassType()
-
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:
Dependable.isPersistent()
-
isValid
public boolean isValid()
Description copied from interface:Dependent
Check that all of the dependent's dependencies are valid.- Specified by:
isValid
in interfaceDependent
- Returns:
- true if the dependent is currently valid
- See Also:
Dependent.isValid()
-
makeInvalid
public void makeInvalid(int action, LanguageConnectionContext lcc) throws StandardException
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:
Dependent.makeInvalid(int, org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
-
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:
Dependent.prepareToInvalidate(org.apache.derby.iapi.sql.depend.Provider, int, org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
-
markUnused
public void markUnused()
Mark the activation as unused.- Specified by:
markUnused
in interfaceActivation
-
isInUse
public boolean isInUse()
Is the activation in use?- Specified by:
isInUse
in interfaceActivation
- Returns:
- true/false
-
addWarning
public void addWarning(java.sql.SQLWarning w)
Description copied from interface:Activation
Add a warning to the activation- Specified by:
addWarning
in interfaceActivation
- See Also:
Activation.addWarning(java.sql.SQLWarning)
-
getWarnings
public java.sql.SQLWarning 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:
Activation.getWarnings()
-
clearWarnings
public void clearWarnings()
Description copied from interface:Activation
Clear the activation's warnings.- Specified by:
clearWarnings
in interfaceActivation
- See Also:
Activation.clearWarnings()
-
informOfRowCount
public void informOfRowCount(NoPutResultSet resultSet, long rowCount) 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:
Activation.informOfRowCount(org.apache.derby.iapi.sql.execute.NoPutResultSet, long)
-
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:
Activation.isCursorActivation()
-
pushConstantAction
public ConstantAction pushConstantAction(ConstantAction newConstantAction)
Description copied from interface:Activation
Push a ConstantAction to be returned by getConstantAction(). Returns the newConstantAction.- Specified by:
pushConstantAction
in interfaceActivation
-
popConstantAction
public ConstantAction 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
public ConstantAction getConstantAction()
Description copied from interface:Activation
Get the top ConstantAction on the stack without changing the stack.- Specified by:
getConstantAction
in interfaceActivation
-
setParentResultSet
public void setParentResultSet(TemporaryRowHolder rs, java.lang.String resultSetId)
- Specified by:
setParentResultSet
in interfaceActivation
-
getParentResultSet
public java.util.Vector<TemporaryRowHolder> getParentResultSet(java.lang.String resultSetId)
Description copied from interface:Activation
get the reference to parent table ResultSets, that will be needed by the referential action dependent table scans.- Specified by:
getParentResultSet
in interfaceActivation
-
clearParentResultSets
public void clearParentResultSets()
- Specified by:
clearParentResultSets
in interfaceActivation
-
getParentResultSetKeys
public java.util.Enumeration<java.lang.String> getParentResultSetKeys()
- Specified by:
getParentResultSetKeys
in interfaceActivation
-
setForUpdateIndexScan
public void setForUpdateIndexScan(CursorResultSet forUpdateResultSet)
Description copied from interface:Activation
beetle 3865: updateable cursor using index. A way of communication between cursor activation and update activation.- Specified by:
setForUpdateIndexScan
in interfaceActivation
-
getForUpdateIndexScan
public CursorResultSet getForUpdateIndexScan()
- Specified by:
getForUpdateIndexScan
in interfaceActivation
-
getDynamicResults
public java.sql.ResultSet[][] getDynamicResults()
Description copied from interface:Activation
Return the set of dynamical created result sets, for procedures. Base implementation returns null, a generated class for a procedure overwrites this with a real implementation.- 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()
Description copied from interface:Activation
Return the maximum number of dynamical created result sets from the procedure definition. Base implementation returns 0, a generated class for a procedure overwrites this with a real implementation.- Specified by:
getMaxDynamicResults
in interfaceActivation
-
getCurrentValueAndAdvance
public NumberDataValue getCurrentValueAndAdvance(java.lang.String sequenceUUIDstring, int typeFormatID) throws StandardException
Description copied from interface:Activation
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
-
-