|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.sql.GenericActivationHolder
public final class GenericActivationHolder
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 | |
|---|---|
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 | |
|---|---|
GenericActivationHolder(LanguageConnectionContext lcc,
GeneratedClass gc,
ExecPreparedStatement ps,
boolean scrollable)
Constructor for an ActivationHolder |
|
| Method Summary | |
|---|---|
void |
addWarning(java.sql.SQLWarning w)
Add a warning to the activation |
boolean |
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()
|
Row |
getCurrentRow(int resultSetNumber)
Get the current row at the given index. |
java.lang.String |
getCursorName()
Return the cursor name of this activation. |
DataValueFactory |
getDataValueFactory()
Get the DataValueFactory |
TableDescriptor |
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 ExecutionFactory |
boolean |
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 activation |
int |
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 |
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.Hashtable |
getParentResultSets()
|
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. |
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). |
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). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public BaseActivation ac
ExecPreparedStatement ps
GeneratedClass gc
DataTypeDescriptor[] paramTypes
private final LanguageConnectionContext lcc
| Constructor Detail |
|---|
GenericActivationHolder(LanguageConnectionContext lcc,
GeneratedClass gc,
ExecPreparedStatement ps,
boolean scrollable)
throws StandardException
gc - The GeneratedClass of the Activationps - The PreparedStatement this ActivationHolder is associated
with
StandardException - Thrown on error| Method Detail |
|---|
public void reset()
throws StandardException
Activation
reset in interface ActivationStandardException - thrown on failureActivation.reset()public boolean checkIfThisActivationHasHoldCursor(java.lang.String tableName)
checkIfThisActivationHasHoldCursor in interface Activationpublic void setCursorName(java.lang.String cursorName)
ActivationThere 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.
setCursorName in interface ActivationcursorName - The cursor name to use.Activation.setCursorName(java.lang.String)public java.lang.String getCursorName()
ActivationStatements that do not support cursors will return a null.
getCursorName in interface ActivationActivation.getCursorName()public void setResultSetHoldability(boolean resultSetHoldability)
Activation
setResultSetHoldability in interface ActivationresultSetHoldability - The new resultset holdability.Activation.setResultSetHoldability(boolean)public boolean getResultSetHoldability()
Activation
getResultSetHoldability in interface ActivationActivation.getResultSetHoldability()
public void setAutoGeneratedKeysResultsetInfo(int[] columnIndexes,
java.lang.String[] columnNames)
Activation
setAutoGeneratedKeysResultsetInfo in interface ActivationcolumnIndexes - 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 positionActivation.setAutoGeneratedKeysResultsetInfo(int[], java.lang.String[])public boolean getAutoGeneratedKeysResultsetMode()
Activation
getAutoGeneratedKeysResultsetMode in interface ActivationActivation.getAutoGeneratedKeysResultsetMode()public int[] getAutoGeneratedKeysColumnIndexes()
Activation
getAutoGeneratedKeysColumnIndexes in interface ActivationActivation.getAutoGeneratedKeysColumnIndexes()public java.lang.String[] getAutoGeneratedKeysColumnNames()
Activation
getAutoGeneratedKeysColumnNames in interface ActivationActivation.getAutoGeneratedKeysColumnNames()public LanguageConnectionContext getLanguageConnectionContext()
Activation
getLanguageConnectionContext in interface ActivationActivation.getLanguageConnectionContext()public TransactionController getTransactionController()
Activation
getTransactionController in interface Activationpublic ExecutionFactory getExecutionFactory()
Activation
getExecutionFactory in interface ActivationActivation.getExecutionFactory()public ParameterValueSet getParameterValueSet()
Activation
getParameterValueSet in interface ActivationActivation.getParameterValueSet()
public void setParameters(ParameterValueSet parameterValues,
DataTypeDescriptor[] parameterTypes)
throws StandardException
ActivationHas 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.
setParameters in interface ActivationparameterValues - The values of the parameters.
StandardExceptionActivation.setParameters(org.apache.derby.iapi.sql.ParameterValueSet, org.apache.derby.iapi.types.DataTypeDescriptor[])
public ResultSet execute()
throws StandardException
Activation
execute in interface ActivationStandardException - Thrown on failureActivation.execute()public ResultSet getResultSet()
Activation
getResultSet in interface ActivationActivation.getResultSet()
public void setCurrentRow(ExecRow currentRow,
int resultSetNumber)
ActivationWhen 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.
setCurrentRow in interface ActivationcurrentRow - The row to be operated upon.resultSetNumber - The resultSetNumber for the current ResultSetActivation.setCurrentRow(org.apache.derby.iapi.sql.execute.ExecRow, int)public Row getCurrentRow(int resultSetNumber)
Activation
getCurrentRow in interface ActivationActivation.getCurrentRow(int)public void clearCurrentRow(int resultSetNumber)
ActivationWhen 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.
clearCurrentRow in interface ActivationresultSetNumber - The resultSetNumber for the current ResultSetActivation.clearCurrentRow(int)public ExecPreparedStatement getPreparedStatement()
Activation
getPreparedStatement in interface ActivationActivation.getPreparedStatement()
public void checkStatementValidity()
throws StandardException
Activation
checkStatementValidity in interface ActivationStandardExceptionpublic ResultDescription getResultDescription()
Activation
getResultDescription in interface ActivationActivation.getResultDescription()public DataValueFactory getDataValueFactory()
Activation
getDataValueFactory in interface ActivationActivation.getDataValueFactory()public RowLocation getRowLocationTemplate(int itemNumber)
Activation
getRowLocationTemplate in interface ActivationitemNumber - The saved item number.
Activation.getRowLocationTemplate(int)public ConglomerateController getHeapConglomerateController()
Activation
getHeapConglomerateController in interface ActivationActivation.getHeapConglomerateController()public void setHeapConglomerateController(ConglomerateController updateHeapCC)
Activation
setHeapConglomerateController in interface ActivationupdateHeapCC - The ConglomerateController to reuse for the update or delete.Activation.setHeapConglomerateController(org.apache.derby.iapi.store.access.ConglomerateController)public void clearHeapConglomerateController()
Activation
clearHeapConglomerateController in interface ActivationActivation.clearHeapConglomerateController()public ScanController getIndexScanController()
Activation
getIndexScanController in interface ActivationActivation.getIndexScanController()public void setIndexScanController(ScanController indexSC)
Activation
setIndexScanController in interface ActivationindexSC - The ScanController to reuse for the update or delete.Activation.setIndexScanController(org.apache.derby.iapi.store.access.ScanController)public long getIndexConglomerateNumber()
Activation
getIndexConglomerateNumber in interface ActivationActivation.getIndexConglomerateNumber()public void setIndexConglomerateNumber(long indexConglomerateNumber)
Activation
setIndexConglomerateNumber in interface ActivationindexConglomerateNumber - The conglomerate number of the index to reuse for the update or delete.Activation.setIndexConglomerateNumber(long)public void clearIndexScanInfo()
Activation
clearIndexScanInfo in interface ActivationActivation.clearIndexScanInfo()
public void close()
throws StandardException
ActivationAny class that implements this must be prepared to be executed from garbage collection, ie. there is no matching context stack.
close in interface ActivationStandardException - Thrown on errorActivation.close()public boolean isClosed()
Activation
isClosed in interface ActivationActivation.isClosed()public void setSingleExecution()
setSingleExecution in interface ActivationActivation.setSingleExecution()public boolean isSingleExecution()
isSingleExecution in interface ActivationActivation.isSingleExecution()public int getNumSubqueries()
getNumSubqueries in interface Activationpublic void setForCreateTable()
Activation
setForCreateTable in interface ActivationActivation.setForCreateTable()public boolean getForCreateTable()
Activation
getForCreateTable in interface ActivationActivation.getForCreateTable()public void setDDLTableDescriptor(TableDescriptor td)
Activation
setDDLTableDescriptor in interface ActivationActivation.setDDLTableDescriptor(org.apache.derby.iapi.sql.dictionary.TableDescriptor)public TableDescriptor getDDLTableDescriptor()
Activation
getDDLTableDescriptor in interface ActivationActivation.getDDLTableDescriptor()public void setMaxRows(long maxRows)
Activation
setMaxRows in interface ActivationmaxRows - Maximum # of rows. (0 means no limit.)Activation.setMaxRows(long)public long getMaxRows()
Activation
getMaxRows in interface ActivationActivation.getMaxRows()public void setTargetVTI(java.sql.ResultSet targetVTI)
Activation
setTargetVTI in interface Activationpublic java.sql.ResultSet getTargetVTI()
Activation
getTargetVTI in interface Activationpublic SQLSessionContext getSQLSessionContextForChildren()
Activation
getSQLSessionContextForChildren in interface Activationpublic SQLSessionContext setupSQLSessionContextForChildren(boolean push)
Activation
setupSQLSessionContextForChildren in interface Activationpush - true if used to push a new connection contextpublic void setParentActivation(Activation a)
Activation
setParentActivation in interface Activationpublic Activation getParentActivation()
Activation
getParentActivation in interface Activationpublic DependableFinder getDependableFinder()
Dependable
getDependableFinder in interface DependableDependable.getDependableFinder()public java.lang.String getObjectName()
Dependable
getObjectName in interface DependableDependable.getObjectName()public UUID getObjectID()
Dependable
getObjectID in interface DependableDependable.getObjectID()public java.lang.String getClassType()
Dependable
getClassType in interface DependableDependable.getClassType()public boolean isPersistent()
Dependable
isPersistent in interface DependableDependable.isPersistent()public boolean isValid()
Dependent
isValid in interface DependentDependent.isValid()
public void makeInvalid(int action,
LanguageConnectionContext lcc)
throws StandardException
Dependent
makeInvalid in interface Dependentaction - The action causing the invalidationlcc - The LanguageConnectionContext
StandardException - thrown if unable to make it invalidDependent.makeInvalid(int, org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
public void prepareToInvalidate(Provider p,
int action,
LanguageConnectionContext lcc)
throws StandardException
Dependent
prepareToInvalidate in interface Dependentp - the provideraction - The action causing the invalidationlcc - The LanguageConnectionContext
StandardException - thrown if unable to make it invalidDependent.prepareToInvalidate(org.apache.derby.iapi.sql.depend.Provider, int, org.apache.derby.iapi.sql.conn.LanguageConnectionContext)public void markUnused()
markUnused in interface Activationpublic boolean isInUse()
isInUse in interface Activationpublic void addWarning(java.sql.SQLWarning w)
Activation
addWarning in interface ActivationActivation.addWarning(java.sql.SQLWarning)public java.sql.SQLWarning getWarnings()
Activation
getWarnings in interface ActivationActivation.getWarnings()public void clearWarnings()
Activation
clearWarnings in interface ActivationActivation.clearWarnings()
public void informOfRowCount(NoPutResultSet resultSet,
long rowCount)
throws StandardException
Activation
informOfRowCount in interface ActivationStandardException - Thrown on errorActivation.informOfRowCount(org.apache.derby.iapi.sql.execute.NoPutResultSet, long)public boolean isCursorActivation()
Activation
isCursorActivation in interface ActivationActivation.isCursorActivation()public ConstantAction getConstantAction()
getConstantAction in interface Activation
public void setParentResultSet(TemporaryRowHolder rs,
java.lang.String resultSetId)
setParentResultSet in interface Activationpublic java.util.Vector getParentResultSet(java.lang.String resultSetId)
Activation
getParentResultSet in interface Activationpublic void clearParentResultSets()
clearParentResultSets in interface Activationpublic java.util.Hashtable getParentResultSets()
getParentResultSets in interface Activationpublic void setForUpdateIndexScan(CursorResultSet forUpdateResultSet)
Activation
setForUpdateIndexScan in interface Activationpublic CursorResultSet getForUpdateIndexScan()
getForUpdateIndexScan in interface Activationpublic java.sql.ResultSet[][] getDynamicResults()
Activation
getDynamicResults in interface Activationpublic int getMaxDynamicResults()
Activation
getMaxDynamicResults in interface Activation
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||