Visitable
public class CursorNode extends DMLStatementNode
Modifier and Type | Field | Description |
---|---|---|
private boolean |
checkIndexStats |
|
private ValueNode |
fetchFirst |
|
private boolean |
forMergeStatement |
|
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<TableDescriptor> |
statsToUpdate |
List of
TableDescriptor s for base tables whose associated
indexes should be checked for stale statistics. |
(package private) static int |
UNSPECIFIED |
|
private java.util.List<java.lang.String> |
updatableColumns |
There can only be a list of updatable columns when FOR UPDATE
is specified as part of the cursor specification.
|
(package private) static int |
UPDATE |
|
private int |
updateMode |
|
private FromTable |
updateTable |
resultSet
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
EMPTY_TD_LIST, NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATION
Constructor | Description |
---|---|
CursorNode(java.lang.String statementType,
ResultSetNode resultSet,
java.lang.String name,
OrderByList orderByList,
ValueNode offset,
ValueNode fetchFirst,
boolean hasJDBClimitClause,
int updateMode,
java.lang.String[] updatableColumns,
boolean forMergeStatement,
ContextManager cm) |
Constructor for a CursorNode
|
Modifier and Type | Method | 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.
|
(package private) void |
generate(ActivationClassBuilder acb,
MethodBuilder mb) |
Do code generation for this CursorNode
|
java.lang.Object |
getCursorInfo() |
Get information about this cursor.
|
protected java.util.ArrayList<java.lang.String> |
getSessionSchemaTableNamesForCursor() |
|
(package private) java.lang.String |
getUpdateBaseTableName() |
|
(package private) java.lang.String |
getUpdateExposedTableName() |
|
(package private) int |
getUpdateMode() |
|
(package private) java.lang.String |
getUpdateSchemaName() |
|
(package private) java.lang.String |
getXML() |
|
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).
|
(package private) 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)
|
(package private) 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, isAtomic, makeResultDescription
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
executeSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilation
static final int UNSPECIFIED
public static final int READ_ONLY
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<java.lang.String> updatableColumns
private FromTable updateTable
private java.util.ArrayList<TableDescriptor> statsToUpdate
TableDescriptor
s for base tables whose associated
indexes should be checked for stale statistics.private boolean checkIndexStats
private int indexOfSessionTableNamesInSavedObjects
private boolean forMergeStatement
CursorNode(java.lang.String statementType, ResultSetNode resultSet, java.lang.String name, OrderByList orderByList, ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause, int updateMode, java.lang.String[] updatableColumns, boolean forMergeStatement, ContextManager cm)
statementType
- 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 array 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.forMergeStatement
- True if this cursor is the driving left-join of a MERGE statementcm
- The context managerpublic java.lang.String toString()
toString
in class StatementNode
java.lang.String statementToString()
statementToString
in class StatementNode
private static java.lang.String updateModeString(int updateMode)
updateMode
- An updateMode identifiervoid printSubNodes(int depth)
printSubNodes
in class DMLStatementNode
depth
- The depth of this node in the treepublic void bindStatement() throws StandardException
bindStatement
in class StatementNode
StandardException
- Thrown on errorprivate void collectTablesWithPossiblyStaleStats() throws StandardException
StandardException
public boolean referencesSessionSchema() throws StandardException
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorprotected java.util.ArrayList<java.lang.String> getSessionSchemaTableNamesForCursor() throws StandardException
StandardException
private 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 DMLStatementNode
StandardException
- Thrown on errorint activationKind()
activationKind
in class DMLStatementNode
StandardException
- Thrown on errorvoid generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- The method the generated code is to go intoStandardException
- Thrown on errorjava.lang.String getUpdateBaseTableName()
java.lang.String getUpdateExposedTableName() throws StandardException
StandardException
java.lang.String getUpdateSchemaName() throws StandardException
StandardException
int getUpdateMode()
public boolean needsSavepoint()
needsSavepoint
in class StatementNode
public java.lang.Object getCursorInfo() throws StandardException
getCursorInfo
in class StatementNode
StandardException
- thrown if generation failsprivate void bindUpdateColumns(FromTable targetTable) throws StandardException
targetTable
- The underlying target tableStandardException
- Thrown on errorjava.lang.String getXML()
public TableDescriptor[] updateIndexStatisticsFor() throws StandardException
updateIndexStatisticsFor
in class StatementNode
StandardException
- if accessing the index descriptors of a base
table failsvoid acceptChildren(Visitor v) throws StandardException
acceptChildren
in class DMLStatementNode
v
- the visitorStandardException
- on errorApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.