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
TableDescriptor s 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 |
resultSet
EMPTY_TD_LIST, NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATION
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
Constructor and Description |
---|
CursorNode() |
Modifier and Type | Method and Description |
---|---|
(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 |
collectTablePrivsAndStats(FromBaseTable fromTable)
Collects required privileges for all types of tables, and 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
|
acceptChildren, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getPrivType, getResultSetNode, init, isAtomic, makeResultDescription
executeSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilation
accept, 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, verifyClassExist
public 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
TableDescriptor
s 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 Node
init
in class QueryTreeNode
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 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 StatementNode
public java.lang.String statementToString()
statementToString
in class StatementNode
private static java.lang.String updateModeString(int updateMode)
updateMode
- An updateMode identifierpublic void 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 collectTablePrivsAndStats(FromBaseTable fromTable)
fromTable
- the tablepublic boolean referencesSessionSchema() throws StandardException
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorprotected java.util.ArrayList 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 errorpublic void 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 errorpublic java.lang.String getUpdateBaseTableName()
public java.lang.String getUpdateExposedTableName() throws StandardException
StandardException
public java.lang.String getUpdateSchemaName() throws StandardException
StandardException
public int getUpdateMode()
private java.lang.String[] getUpdatableColumns()
private ResultColumnDescriptor[] genTargetResultColList() throws StandardException
StandardException
- Thrown on errorpublic boolean needsSavepoint()
needsSavepoint
in class StatementNode
public java.lang.Object getCursorInfo() throws StandardException
getCursorInfo
in class QueryTreeNode
StandardException
- 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 StatementNode
StandardException
- if accessing the index descriptors of a base
table failsApache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.