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

public abstract Class BaseActivation

extends Object
implements CursorActivation, GeneratedByteCode
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.loader.GeneratedByteCode, org.apache.derby.iapi.sql.execute.CursorActivation, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.depend.Dependent, org.apache.derby.catalog.Dependable
Known Direct Subclasses
org.apache.derby.impl.sql.execute.ConstantActionActivation, org.apache.derby.impl.sql.execute.CursorActivation
Imports
java.sql.Connection, .SQLException, .SQLWarning, java.util.ArrayList, .Enumeration, .HashSet, .Hashtable, .Stack, .Vector, org.apache.derby.catalog.Dependable, .DependableFinder, .UUID, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.jdbc.ConnectionContext, org.apache.derby.shared.common.reference.Property, .SQLState, org.apache.derby.iapi.services.context.Context, .ContextManager, org.apache.derby.shared.common.util.ArrayUtil, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.services.loader.GeneratedByteCode, .GeneratedClass, .GeneratedMethod, org.apache.derby.iapi.services.monitor.ModuleFactory, .Monitor, org.apache.derby.iapi.services.property.PropertyUtil, org.apache.derby.iapi.services.uuid.UUIDFactory, org.apache.derby.iapi.sql.Activation, .ParameterValueSet, .PreparedStatement, .ResultDescription, .ResultSet, .Row, org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .SQLSessionContext, org.apache.derby.iapi.sql.depend.DependencyManager, .Provider, org.apache.derby.iapi.sql.dictionary.TableDescriptor, org.apache.derby.iapi.sql.execute.ConstantAction, .CursorActivation, .CursorResultSet, .ExecPreparedStatement, .ExecRow, .ExecutionFactory, .NoPutResultSet, .ResultSetFactory, .TemporaryRowHolder, org.apache.derby.iapi.store.access.ConglomerateController, .Qualifier, .ScanController, .TransactionController, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor, .DataValueFactory, .NumberDataValue, .RowLocation, .StringDataValue, org.apache.derby.shared.common.sanity.SanityManager

BaseActivation provides the fundamental support we expect all activations to have. Doesn't actually implement any of the activation interface, expects the subclasses to do that.

Field Summary

Modifier and TypeField and Description
private int[]
private String[]
private boolean
private Calendar
private boolean
protected boolean
protected ContextManager
private Stack<ConstantAction>
constantActionStack

Stack of ConstantActions.

private String
private TableDescriptor
private boolean
private CursorResultSet
private GeneratedClass
private long
protected int
private ScanController
private volatile boolean
private boolean
isValid

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
parentActivation

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 HashSet<Integer>
private boolean
private boolean
private SQLSessionContext
sqlSessionContextForChildren

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
UUIDString

For dependency tracking

protected UUID
UUIDValue

For dependency tracking

private SQLWarning

Constructor Summary

AccessConstructor and Description
protected

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 static void
allocateQualArray(Qualifier[][]
The array of Qualifier arrays.
qualifiers
,
int
The position in the array to set
position
,
int
The array length of the qualifier array to allocate.
length
)

Allocate an array of qualifiers and initialize in Qualifier[][]

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.

protected void
checkPositionedStatement(String
Name of the cursor
cursorName
,
String
Object name of the PreparedStatement.
psName
)

Check that a positioned statement is executing against a cursor from the same PreparedStatement (plan) that the positioned statement was original compiled against.

public final 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.

Clear the current row for the specified ResultSet.

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
clearParentResultSets()

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

prepared statement use the same activation for multiple execution.

public void
clearWarnings()

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

Clear the activation's warnings.

public final void
close()

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

Closing an activation marks it as unusable.

protected void
closeActivationAction()

A generated class can create its own closeActivationAction method to invoke special logic when the activation is closed.

protected abstract ResultSet

Returns:

the root of the ResultSet tree for this statement
createResultSet
()

Create the ResultSet tree for this statement.

pack-priv ResultSet

Returns:

the root of the ResultSet tree for this statement
decorateResultSet
()

Create the ResultSet tree for this statement, and possibly perform extra checks or initialization required by specific sub-classes.

public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public final 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.

protected Calendar
getCalendar()

Return a calendar for use by this activation.

public String
getClassType()

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

Get the unique class id for the Dependable.

protected final DataValueDescriptor
getColumnFromRow(int rsNumber, int colId)

public ConstantAction
getConstantAction()

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

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

public ContextManager

Returns:

Current ContextManager
getContextManager
()

Get the Current ContextManager.

public Connection
getCurrentConnection()

Used to get a proxy for the current connection.

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

Returns:

The next number in the sequence
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
public CursorResultSet

Returns:

null
getCursorResultSet
()

Implements org.apache.derby.iapi.sql.execute.CursorActivation.getCursorResultSet.

Used in CurrentOfResultSet to get to the cursor result set for a cursor.

public DataValueFactory
getDataValueFactory()

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

Used by activations to generate data values.

public NumberDataValue

Returns:

the DB2 compatible length, set to null if value is null.
getDB2Length
(DataValueDescriptor value, int
The length, if it is a constant modulo null/not null. -1 if the length is not constant
constantLength
,
NumberDataValue
If non-null then re-use this as a container for the length
reUse
)

Compute the DB2 compatible length of a value.

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.

Real implementations of this method are provided by a generated class.

public final ExecutionFactory
getExecutionFactory()

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

Used in activations for generating rows.

public boolean
getForCreateTable()

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

Get whether or not this activation is for create table.

public CursorResultSet
public final GeneratedClass
getGC()

Implements org.apache.derby.iapi.services.loader.GeneratedByteCode.getGC.

Get the GeneratedClass object for this object.

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 final LanguageConnectionContext
getLanguageConnectionContext()

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

Get the language connection factory associated with this connection

public int
getMaxDynamicResults()

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

Real implementations of this method are provided by a generated class.

public long
getMaxRows()

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

Get the maximum # of rows.

public final GeneratedMethod
pack-priv static ModuleFactory
getMonitor()

Must be package private so that user code can't call this entry point.

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.

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)

public ParameterValueSet
public Activation

Returns:

The parent's activation
getParentActivation
()

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

Get the activation of the calling statement or parent statement.

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 final 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
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 final ResultSetFactory
getResultSetFactory()

Used in the execute method of activations for generating the result sets that they concatenate together.

public boolean
getResultSetHoldability()

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

Return the holdability of this activation.

public RowLocation

Returns:

A RowLocation template for the conglomerate
getRowLocationTemplate
(int
The saved item number.
itemNumber
)

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

Get the saved RowLocation.

public final boolean
protected DataValueDescriptor

Returns:

The next autoincrement value which should be inserted. returns the correct number datatype.
getSetAutoincrementValue
(int columnPosition, long increment)

Called by generated code to compute the next autoincrement value.

public SQLSessionContext
getSQLSessionContextForChildren()

Implements org.apache.derby.iapi.sql.Activation.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.

public CursorResultSet

Returns:

null.
getTargetResultSet
()

Implements org.apache.derby.iapi.sql.execute.CursorActivation.getTargetResultSet.

Used in CurrentOfResultSet to get to the target result set for a cursor.

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 final 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
currentRowCount
)

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 final void
initFromContext(Context
The context to use
context
)

Implements org.apache.derby.iapi.services.loader.GeneratedByteCode.initFromContext.

Initialize the generated class from a context.

public boolean

Returns:

true if the prepared statement has been closed.
isClosed
()

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

Find out if the activation closed or not.

public boolean
public final 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.

Returns true if this Activation is only going to be used for one 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 final void
markUnused()

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

Mark the activation as unused.

public NoPutResultSet
protected static void
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().

protected void
reinit()

Reinitialize data structures added by the sub-classes before each execution of the statement.

public static void
reinitializeQualifiers(Qualifier[][]
The array of Qualifiers
qualifiers
)

Reinitialize all Qualifiers in an array of Qualifiers.

public void
reset()

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

This is a partial implementation of reset.

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 static void
setColumnPosition(int[]
The array of column positions
columnPositions
,
int
The place to put the column position
positionToSet
,
int
The column position
column
)

Set a column position in an array of column positions.

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.

Remember the row for the specified ResultSet.

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

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

remember the cursor name

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

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

beetle 3865: updateable cursor using index.

public final void
setGC(GeneratedClass
A generated class
gc
)

Implements org.apache.derby.iapi.services.loader.GeneratedByteCode.setGC.

Set the Generated Class.

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.

protected final void
setParameterValueSet(int paramCount, boolean hasReturnParam)

public void
setParentActivation(Activation
The caller's or superstatement's activation
a
)

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

This activation is created in a dynamic call context or a substatement execution context, make note of its parent statements activation (a).

public void
public static void
setQualifier(Qualifier[][]
The array of Qualifiers
qualifiers
,
Qualifier
The Qualifier
qualifier
,
int
The Nth array index into qualifiers[N][M]
position_1
,
int
The Nth array index into qualifiers[N][M]
position_2
)

Set a Qualifier in a 2 dimensional array of Qualifiers.

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 this 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 final void
setupActivation(ExecPreparedStatement
prepared statement
ps
,
boolean
activation for a scrollable result set
scrollable
)

Link this activation with its PreparedStatement.

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

protected boolean

Returns:

true if the row counts should be checked, false otherwise
shouldWeCheckRowCounts
()

Find out if it's time to check the row counts of the tables involved in this query.

public void
throwIfClosed(String op)

Various activation methods need to disallow their invocation if the activation is closed.</verbatim></verbatim>

public void
throwIfMissingParms()

Throw an exception if any parameters are uninitialized.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait