Top Description Fields Constructors Methods
org.apache.derby.impl.sql

public final Class GenericActivationHolder

extends Object
implements Activation
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.depend.Dependent, org.apache.derby.catalog.Dependable
Imports
java.sql.SQLWarning, java.util.Enumeration, .Vector, org.apache.derby.catalog.Dependable, .DependableFinder, .UUID, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.loader.GeneratedClass, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.Activation, .ParameterValueSet, .ResultDescription, .ResultSet, .Row, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .SQLSessionContext, org.apache.derby.iapi.sql.depend.Provider, org.apache.derby.iapi.sql.dictionary.TableDescriptor, org.apache.derby.iapi.sql.execute.ConstantAction, .CursorResultSet, .ExecPreparedStatement, .ExecRow, .ExecutionFactory, .NoPutResultSet, .TemporaryRowHolder, org.apache.derby.iapi.store.access.ConglomerateController, .ScanController, .TransactionController, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueFactory, .NumberDataValue, .RowLocation, org.apache.derby.impl.sql.execute.BaseActivation

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

Modifier and TypeField and Description
public BaseActivation
pack-priv GeneratedClass
private final LanguageConnectionContext
pack-priv DataTypeDescriptor[]
pack-priv ExecPreparedStatement

Constructor Summary

AccessConstructor and Description
pack-priv
GenericActivationHolder(LanguageConnectionContext lcc, GeneratedClass
The GeneratedClass of the Activation
gc
,
ExecPreparedStatement
The PreparedStatement this ActivationHolder is associated with
ps
,
boolean scrollable)

Constructor for an ActivationHolder

Method Summary

Modifier and TypeMethod and Description
public void
addWarning(SQLWarning
The next warning to chain to the end of the list
w
)

Implements org.apache.derby.iapi.sql.Activation.addWarning.

Add a warning to the activation

public boolean

Returns:

true if this activation has held cursor and if it references the passed temp table name
checkIfThisActivationHasHoldCursor
(String
A table name
tableName
)

Implements org.apache.derby.iapi.sql.Activation.checkIfThisActivationHasHoldCursor.

Temporary tables can be declared with ON COMMIT DELETE ROWS.

public void
checkStatementValidity()

Implements org.apache.derby.iapi.sql.Activation.checkStatementValidity.

Check the validity of the current executing statement.

public void
clearCurrentRow(int
The resultSetNumber for the current ResultSet
resultSetNumber
)

Implements org.apache.derby.iapi.sql.Activation.clearCurrentRow.

Generated plans have a current row field for ease in defining the methods and finding them dynamically.

public void
clearHeapConglomerateController()

Implements org.apache.derby.iapi.sql.Activation.clearHeapConglomerateController.

Clear the ConglomerateController to be used for an update or delete.

public void
clearIndexScanInfo()

Implements org.apache.derby.iapi.sql.Activation.clearIndexScanInfo.

Clear the info for the index to be re-used for update/delete.

public void
public void
clearWarnings()

Implements org.apache.derby.iapi.sql.Activation.clearWarnings.

Clear the activation's warnings.

public void
close()

Implements org.apache.derby.iapi.sql.Activation.close.

Closing an activation statement marks it as unusable.

public ResultSet
execute()

Implements org.apache.derby.iapi.sql.Activation.execute.

When the prepared statement is executed, it passes execution on to the activation execution was requested for.

public int[]
getAutoGeneratedKeysColumnIndexes()

Implements org.apache.derby.iapi.sql.Activation.getAutoGeneratedKeysColumnIndexes.

Returns the column positions array of columns requested in auto-generated keys resultset for this avtivation.

public String[]
getAutoGeneratedKeysColumnNames()

Implements org.apache.derby.iapi.sql.Activation.getAutoGeneratedKeysColumnNames.

Returns the column names array of columns requested in auto-generated keys resultset for this avtivation.

public boolean
getAutoGeneratedKeysResultsetMode()

Implements org.apache.derby.iapi.sql.Activation.getAutoGeneratedKeysResultsetMode.

Returns true if auto-generated keys resultset request was made for this avtivation.

public String
getClassType()

Implements org.apache.derby.catalog.Dependable.getClassType.

Get the unique class id for the Dependable.

public ConstantAction
getConstantAction()

Implements org.apache.derby.iapi.sql.Activation.getConstantAction.

Get the top ConstantAction on the stack without changing the stack.

public Row
getCurrentRow(int
Index into list of result sets
resultSetNumber
)

Implements org.apache.derby.iapi.sql.Activation.getCurrentRow.

Get the current row at the given index.

public NumberDataValue
getCurrentValueAndAdvance(String
The string value of the sequence's UUID
sequenceUUIDstring
,
int
The format id of the data type to be returned. E.g., StoredFormatIds.SQL_INTEGER_ID.
typeFormatID
)

Implements org.apache.derby.iapi.sql.Activation.getCurrentValueAndAdvance.

Called by generated code to get the next number in an ANSI/ISO sequence and advance the sequence.

public String
getCursorName()

Implements org.apache.derby.iapi.sql.Activation.getCursorName.

Return the cursor name of this activation.

public DataValueFactory
public TableDescriptor
getDDLTableDescriptor()

Implements org.apache.derby.iapi.sql.Activation.getDDLTableDescriptor.

Get the TableDescriptor for the target of DDL.

public DependableFinder
getDependableFinder()

Implements org.apache.derby.catalog.Dependable.getDependableFinder.

Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.

public ResultSet[][]
getDynamicResults()

Implements org.apache.derby.iapi.sql.Activation.getDynamicResults.

Return the set of dynamical created result sets, for procedures.

public ExecutionFactory
public boolean
getForCreateTable()

Implements org.apache.derby.iapi.sql.Activation.getForCreateTable.

Get whether or not this activation is for create table.

public CursorResultSet
public ConglomerateController
getHeapConglomerateController()

Implements org.apache.derby.iapi.sql.Activation.getHeapConglomerateController.

Get the ConglomerateController, if any, that has already been opened for the heap when scaning for an update or delete.

public long
getIndexConglomerateNumber()

Implements org.apache.derby.iapi.sql.Activation.getIndexConglomerateNumber.

Get the conglomerate number of the index, if any, that has already been opened for scaning for an update or delete.

public ScanController
getIndexScanController()

Implements org.apache.derby.iapi.sql.Activation.getIndexScanController.

Get the ScanController, if any, that has already been opened for the index when scaning for an update or delete.

public LanguageConnectionContext
getLanguageConnectionContext()

Implements org.apache.derby.iapi.sql.Activation.getLanguageConnectionContext.

Get the language connection context associated with this activation

public int
getMaxDynamicResults()

Implements org.apache.derby.iapi.sql.Activation.getMaxDynamicResults.

Return the maximum number of dynamical created result sets from the procedure definition.

public long
getMaxRows()

Implements org.apache.derby.iapi.sql.Activation.getMaxRows.

Get the maximum # of rows.

public int

Returns:

int The number of subqueries in the entire query.
getNumSubqueries
()

Implements org.apache.derby.iapi.sql.Activation.getNumSubqueries.

Get the number of subqueries in the entire query.

public UUID
getObjectID()

Implements org.apache.derby.catalog.Dependable.getObjectID.

Get the UUID of this Dependable OBJECT.

public String
getObjectName()

Implements org.apache.derby.catalog.Dependable.getObjectName.

Get the name of this Dependable OBJECT.

public ParameterValueSet
getParameterValueSet()

Implements org.apache.derby.iapi.sql.Activation.getParameterValueSet.

Gets the ParameterValueSet for this execution of the statement.

public Activation
getParentActivation()

Implements org.apache.derby.iapi.sql.Activation.getParentActivation.

This activation is created in a dynamic call context, or substatement execution context; get its caller's or superstatement's activation.

public Vector<TemporaryRowHolder>
getParentResultSet(String
An handle on the result set
resultSetId
)

Implements org.apache.derby.iapi.sql.Activation.getParentResultSet.

get the reference to parent table ResultSets, that will be needed by the referential action dependent table scans.

public Enumeration<String>
public ExecPreparedStatement
getPreparedStatement()

Implements org.apache.derby.iapi.sql.Activation.getPreparedStatement.

Get the prepared statement that this activation is for.

public ResultDescription
getResultDescription()

Implements org.apache.derby.iapi.sql.Activation.getResultDescription.

Get the result description for this activation, if it has one.

public ResultSet

Returns:

the current ResultSet of this activation.
getResultSet
()

Implements org.apache.derby.iapi.sql.Activation.getResultSet.

Returns the current result set for this activation, i.e. the one returned by the last execute() call.

public boolean
getResultSetHoldability()

Implements org.apache.derby.iapi.sql.Activation.getResultSetHoldability.

Return the holdability of this activation.

public RowLocation
getRowLocationTemplate(int
The saved item number.
itemNumber
)

Implements org.apache.derby.iapi.sql.Activation.getRowLocationTemplate.

Get the saved RowLocation.

public SQLSessionContext
getSQLSessionContextForChildren()

Implements org.apache.derby.iapi.sql.Activation.getSQLSessionContextForChildren.

Get the current SQL session context if in a nested connection of a stored routine or in a substatement.

public ResultSet
getTargetVTI()

Implements org.apache.derby.iapi.sql.Activation.getTargetVTI.

Get the ResultSet for the target of an update/delete to a VTI.

public TransactionController
getTransactionController()

Implements org.apache.derby.iapi.sql.Activation.getTransactionController.

Get the Execution TransactionController associated with this activation/lcc.

public SQLWarning
getWarnings()

Implements org.apache.derby.iapi.sql.Activation.getWarnings.

Returns the chained list of warnings.

public void
informOfRowCount(NoPutResultSet
The result set to inform on
resultSet
,
long
The number of rows found in that result set
rowCount
)

Implements org.apache.derby.iapi.sql.Activation.informOfRowCount.

Tell this activation that the given ResultSet was found to have the given number of rows.

public boolean
isClosed()

Implements org.apache.derby.iapi.sql.Activation.isClosed.

Find out if the activation is closed or not.

public boolean
public boolean

Returns:

true/false
isInUse
()

Implements org.apache.derby.iapi.sql.Activation.isInUse.

Is the activation in use?

public boolean
isPersistent()

Implements org.apache.derby.catalog.Dependable.isPersistent.

Return whether or not this Dependable is persistent.

public boolean
isSingleExecution()

Implements org.apache.derby.iapi.sql.Activation.isSingleExecution.

Is the activation set up for a single execution.

public boolean
isValid()

Implements org.apache.derby.iapi.sql.depend.Dependent.isValid.

Check that all of the dependent's dependencies are valid.

public void
makeInvalid(int
The action causing the invalidation
action
,
LanguageConnectionContext
The LanguageConnectionContext
lcc
)

Implements org.apache.derby.iapi.sql.depend.Dependent.makeInvalid.

Mark the dependent as invalid (due to at least one of its dependencies being invalid).

public void
markUnused()

Implements org.apache.derby.iapi.sql.Activation.markUnused.

Mark the activation as unused.

public ConstantAction
popConstantAction()

Implements org.apache.derby.iapi.sql.Activation.popConstantAction.

Pop the ConstantAction stack, returning the element which was just popped off the stack.

public void
prepareToInvalidate(Provider
the provider
p
,
int
The action causing the invalidation
action
,
LanguageConnectionContext
The LanguageConnectionContext
lcc
)

Implements org.apache.derby.iapi.sql.depend.Dependent.prepareToInvalidate.

Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).

public ConstantAction
pushConstantAction(ConstantAction
The new constant action to push
newConstantAction
)

Implements org.apache.derby.iapi.sql.Activation.pushConstantAction.

Push a ConstantAction to be returned by getConstantAction().

public void
reset()

Implements org.apache.derby.iapi.sql.Activation.reset.

Resets the activation to the "pre-execution" state - that is, the state where it can be used to begin a new execution.

public void
setAutoGeneratedKeysResultsetInfo(int[]
Request specific columns in auto-generated keys resultset by passing column positions. null means no specific columns requested by position
columnIndexes
,
String[]
Request specific columns in auto-generated keys resultset by passing column names. null means no specific columns requested by position
columnNames
)

Implements org.apache.derby.iapi.sql.Activation.setAutoGeneratedKeysResultsetInfo.

Set the auto-generated keys resultset mode to true for this activation.

public void
setCurrentRow(ExecRow
The row to be operated upon.
currentRow
,
int
The resultSetNumber for the current ResultSet
resultSetNumber
)

Implements org.apache.derby.iapi.sql.Activation.setCurrentRow.

Generated plans have a current row field for ease in defining the methods and finding them dynamically.

public void
setCursorName(String
The cursor name to use.
cursorName
)

Implements org.apache.derby.iapi.sql.Activation.setCursorName.

JDBC requires that all select statements be converted into cursors, and that the cursor name be settable for each execution of a select statement.

public void
setDDLTableDescriptor(TableDescriptor
The table descriptor for the target of the DDL
td
)

Implements org.apache.derby.iapi.sql.Activation.setDDLTableDescriptor.

Save the TableDescriptor for the target of DDL so that it can be passed between the various ConstantActions during execution.

public void
setForCreateTable()

Implements org.apache.derby.iapi.sql.Activation.setForCreateTable.

Mark the Activation as being for create table.

public void
setForUpdateIndexScan(CursorResultSet
An updatable result set
forUpdateResultSet
)

Implements org.apache.derby.iapi.sql.Activation.setForUpdateIndexScan.

beetle 3865: updateable cursor using index.

public void
setHeapConglomerateController(ConglomerateController
The ConglomerateController to reuse for the update or delete.
updateHeapCC
)

Implements org.apache.derby.iapi.sql.Activation.setHeapConglomerateController.

Set the ConglomerateController to be used for an update or delete.

public void
setIndexConglomerateNumber(long
The conglomerate number of the index to reuse for the update or delete.
indexConglomerateNumber
)

Implements org.apache.derby.iapi.sql.Activation.setIndexConglomerateNumber.

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.)

public void
setIndexScanController(ScanController
The ScanController to reuse for the update or delete.
indexSC
)

Implements org.apache.derby.iapi.sql.Activation.setIndexScanController.

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.)

public void
setMaxRows(long
Maximum # of rows. (0 means no limit.)
maxRows
)

Implements org.apache.derby.iapi.sql.Activation.setMaxRows.

Set the maximum # of rows.

public void
setParameters(ParameterValueSet
The values of the parameters.
parameterValues
,
DataTypeDescriptor[]
Their types
parameterTypes
)

Implements org.apache.derby.iapi.sql.Activation.setParameters.

Sets the parameter values for this execution of the statement.

public void
setParentActivation(Activation
The parent activation
a
)

Implements org.apache.derby.iapi.sql.Activation.setParentActivation.

This activation is created in a dynamic call context or a substatement execution context, chain its parent statements activation.

public void
public void
setResultSetHoldability(boolean
The new resultset holdability.
resultSetHoldability
)

Implements org.apache.derby.iapi.sql.Activation.setResultSetHoldability.

Set current resultset holdability.

public void
setSingleExecution()

Implements org.apache.derby.iapi.sql.Activation.setSingleExecution.

Set the activation for a single execution.

public void
setTargetVTI(ResultSet
The result set which is the target of an updatable VTI
targetVTI
)

Implements org.apache.derby.iapi.sql.Activation.setTargetVTI.

Save the ResultSet for the target of an update/delete to a VTI.

public SQLSessionContext
setupSQLSessionContextForChildren(boolean
true if used to push a new connection context
push
)

Implements org.apache.derby.iapi.sql.Activation.setupSQLSessionContextForChildren.

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).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait