public class CursorNode extends DMLStatementNode
| Modifier and Type | Field and Description |
|---|---|
private boolean |
checkIndexStats |
private ValueNode |
fetchFirst |
private boolean |
hasJDBClimitClause |
private int |
indexOfSessionTableNamesInSavedObjects |
private java.lang.String |
name |
private boolean |
needTarget |
private ValueNode |
offset |
private OrderByList |
orderByList |
static int |
READ_ONLY |
private java.lang.String |
statementType |
private java.util.ArrayList |
statsToUpdate
List of
TableDescriptors for base tables whose associated
indexes should be checked for stale statistics. |
private ResultColumnDescriptor[] |
targetColumnDescriptors |
static int |
UNSPECIFIED |
private java.util.List |
updatableColumns
There can only be a list of updatable columns when FOR UPDATE
is specified as part of the cursor specification.
|
static int |
UPDATE |
private int |
updateMode |
private FromTable |
updateTable |
resultSetEMPTY_TD_LIST, NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATIONAUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX| Constructor and Description |
|---|
CursorNode() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node.
|
(package private) int |
activationKind()
Returns the type of activation this class
generates.
|
void |
bindStatement()
Bind this CursorNode.
|
private void |
bindUpdateColumns(FromTable targetTable)
Bind the update columns by their names to the target table
of the cursor specification.
|
private void |
collectTablesWithPossiblyStaleStats()
Collects table descriptors for base tables whose index statistics we
want to check for staleness (or to create).
|
private int |
determineUpdateMode(DataDictionary dataDictionary)
Take a cursor and determine if it is UPDATE
or READ_ONLY based on the shape of the cursor specification.
|
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Do code generation for this CursorNode
|
private ResultColumnDescriptor[] |
genTargetResultColList()
Positioned update needs to know what the target result set
looks like.
|
java.lang.Object |
getCursorInfo()
Get information about this cursor.
|
protected java.util.ArrayList |
getSessionSchemaTableNamesForCursor() |
private java.lang.String[] |
getUpdatableColumns()
Return String[] of names from the FOR UPDATE OF List
|
java.lang.String |
getUpdateBaseTableName() |
private java.lang.String[] |
getUpdateColumnNames()
Get an array of strings for each updatable column
in this list.
|
java.lang.String |
getUpdateExposedTableName() |
int |
getUpdateMode() |
java.lang.String |
getUpdateSchemaName() |
java.lang.String |
getXML() |
void |
init(java.lang.Object statementType,
java.lang.Object resultSet,
java.lang.Object name,
java.lang.Object orderByList,
java.lang.Object offset,
java.lang.Object fetchFirst,
java.lang.Object hasJDBClimitClause,
java.lang.Object updateMode,
java.lang.Object updatableColumns)
Initializer for a CursorNode
|
boolean |
needsSavepoint()
Returns whether or not this Statement requires a set/clear savepoint
around its execution.
|
void |
optimizeStatement()
Optimize a DML statement (which is the only type of statement that
should need optimizing, I think).
|
void |
printSubNodes(int depth)
Prints the sub-nodes of this object.
|
boolean |
referencesSessionSchema()
Return true if the node references SESSION schema tables (temporary or permanent)
|
java.lang.String |
statementToString() |
java.lang.String |
toString()
Convert this object to a String.
|
TableDescriptor[] |
updateIndexStatisticsFor()
Returns a list of base tables for which the index statistics of the
associated indexes should be updated.
|
private static java.lang.String |
updateModeString(int updateMode)
Support routine for translating an updateMode identifier to a String
|
bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getPrivType, getResultSetNode, init, isAtomic, makeResultDescriptionexecuteSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilationaccept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExistpublic static final int UNSPECIFIED
public static final int READ_ONLY
public static final int UPDATE
private java.lang.String name
private OrderByList orderByList
private ValueNode offset
private ValueNode fetchFirst
private boolean hasJDBClimitClause
private java.lang.String statementType
private int updateMode
private boolean needTarget
private java.util.List updatableColumns
private FromTable updateTable
private ResultColumnDescriptor[] targetColumnDescriptors
private java.util.ArrayList statsToUpdate
TableDescriptors for base tables whose associated
indexes should be checked for stale statistics.private boolean checkIndexStats
private int indexOfSessionTableNamesInSavedObjects
public void init(java.lang.Object statementType,
java.lang.Object resultSet,
java.lang.Object name,
java.lang.Object orderByList,
java.lang.Object offset,
java.lang.Object fetchFirst,
java.lang.Object hasJDBClimitClause,
java.lang.Object updateMode,
java.lang.Object updatableColumns)
init in interface Nodeinit in class QueryTreeNodestatementType - Type of statement (SELECT, UPDATE, INSERT)resultSet - A ResultSetNode specifying the result set for
the cursorname - The name of the cursor, null if no nameorderByList - The order by list for the cursor, null if no
order by listoffset - The value of a fetchFirst - The value of a hasJDBClimitClause - True if the offset/fetchFirst clauses come from JDBC limit/offset escape syntaxupdateMode - The user-specified update mode for the cursor,
for example, CursorNode.READ_ONLYupdatableColumns - The list of updatable columns specified by
the user in the FOR UPDATE clause, null if no
updatable columns specified. May only be
provided if the updateMode parameter is
CursorNode.UPDATE.public java.lang.String toString()
toString in class StatementNodepublic java.lang.String statementToString()
statementToString in class StatementNodeprivate static java.lang.String updateModeString(int updateMode)
updateMode - An updateMode identifierpublic void printSubNodes(int depth)
printSubNodes in class DMLStatementNodedepth - The depth of this node in the treepublic void bindStatement()
throws StandardException
bindStatement in class StatementNodeStandardException - Thrown on errorprivate void collectTablesWithPossiblyStaleStats()
throws StandardException
StandardExceptionpublic boolean referencesSessionSchema()
throws StandardException
referencesSessionSchema in class QueryTreeNodeStandardException - Thrown on errorprotected java.util.ArrayList getSessionSchemaTableNamesForCursor()
throws StandardException
StandardExceptionprivate int determineUpdateMode(DataDictionary dataDictionary) throws StandardException
The following conditions make a cursor read only:
StandardException - Thrown on errorpublic void optimizeStatement()
throws StandardException
optimizeStatement in class DMLStatementNodeStandardException - Thrown on errorint activationKind()
activationKind in class DMLStatementNodeStandardException - Thrown on errorpublic void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate in class QueryTreeNodeacb - The ActivationClassBuilder for the class being builtmb - The method the generated code is to go intoStandardException - Thrown on errorpublic java.lang.String getUpdateBaseTableName()
public java.lang.String getUpdateExposedTableName()
throws StandardException
StandardExceptionpublic java.lang.String getUpdateSchemaName()
throws StandardException
StandardExceptionpublic int getUpdateMode()
private java.lang.String[] getUpdatableColumns()
private ResultColumnDescriptor[] genTargetResultColList() throws StandardException
StandardException - Thrown on errorpublic boolean needsSavepoint()
needsSavepoint in class StatementNodepublic java.lang.Object getCursorInfo()
throws StandardException
getCursorInfo in class QueryTreeNodeStandardException - thrown if generation failsprivate void bindUpdateColumns(FromTable targetTable) throws StandardException
targetTable - The underlying target tableStandardException - Thrown on errorprivate java.lang.String[] getUpdateColumnNames()
public java.lang.String getXML()
public TableDescriptor[] updateIndexStatisticsFor() throws StandardException
updateIndexStatisticsFor in class StatementNodeStandardException - if accessing the index descriptors of a base
table failsvoid acceptChildren(Visitor v) throws StandardException
acceptChildren in class DMLStatementNodev - the visitorStandardException - on errorApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.