Visitable
public final class UpdateNode extends DMLModGeneratedColumnsStatementNode
Modifier and Type | Field | Description |
---|---|---|
(package private) int[] |
changedColumnIds |
|
(package private) ValueNode |
checkConstraints |
|
(package private) static java.lang.String |
COLUMNNAME |
|
(package private) boolean |
deferred |
|
protected boolean |
positionedUpdate |
|
protected FormatableBitSet |
readColsBitSet |
|
protected FromTable |
targetTable |
autoincRowLocation, identitySequenceUUIDString
dependentTables, fkColArrays, fkColDescriptors, fkIndexConglomNumbers, fkInfo, fkRefActions, fkSchemaNames, fkTableNames, indexConglomerateNumbers, indexNames, indicesToMaintain, isDependentTable, lockMode, matchingClause, relevantCdl, relevantTriggers, resultColumnList, synonymTableName, targetTableDescriptor, targetTableName, targetVTI, triggerInfo
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 |
---|---|
UpdateNode(TableName targetTableName,
ResultSetNode resultSet,
MatchingClauseNode matchingClause,
ContextManager cm) |
Constructor for an UpdateNode.
|
Modifier and Type | Method | Description |
---|---|---|
private static void |
addGeneratedColumnPrecursors(TableDescriptor baseTable,
ColumnDescriptorList affectedGeneratedColumns,
FormatableBitSet columnMap) |
Add all of the columns mentioned by the generation clauses of generated
columns.
|
private void |
addGeneratedColumns(TableDescriptor baseTable,
ResultSetNode updateSet,
ColumnDescriptorList affectedGeneratedColumns,
ColumnDescriptorList addedGeneratedColumns) |
Add generated columns to the update list as necessary.
|
private void |
addUpdatePriv(java.util.ArrayList<java.lang.String> explicitlySetColumns) |
Add UPDATE_PRIV on all columns on the left side of SET operators.
|
private void |
associateAddedColumns() |
Associate all added columns with the TARGET table of the enclosing
MERGE statement.
|
void |
bindStatement() |
Bind this UpdateNode.
|
private void |
checkTableNameAndScrubResultColumns(ResultColumnList rcl) |
Check table name and then clear it from the result set columns.
|
private java.util.List<CastNode> |
collectAllCastNodes() |
Collect all of the CastNodes in the WHERE clause and on the right side
of SET operators.
|
private java.util.List<ColumnReference> |
collectAllResultSetColumns() |
Collect all of the result set columns.
|
private void |
collectPrivilegedNodes(java.util.ArrayList<QueryTreeNode> result,
QueryTreeNode expr) |
Add to an evolving list all of the nodes under an expression which may require privilege checks.
|
private void |
forbidGenerationOverrides(ResultColumnList targetRCL,
ColumnDescriptorList addedGeneratedColumns) |
Do not allow generation clauses to be overriden.
|
(package private) void |
generate(ActivationClassBuilder acb,
MethodBuilder mb) |
Code generation for update.
|
private int[] |
getChangedColumnIds(ResultColumnList rcl) |
Construct the changedColumnIds array.
|
private java.util.ArrayList<java.lang.String> |
getExplicitlySetColumns() |
Get the names of the explicitly set columns, that is, the columns on the left side
of SET operators.
|
(package private) int |
getPrivType() |
Return default privilege needed for this node.
|
(package private) FormatableBitSet |
getReadMap(DataDictionary dd,
TableDescriptor baseTable,
ResultColumnList updateColumnList,
ColumnDescriptorList affectedGeneratedColumns) |
Gets the map of all columns which must be read out of the base table.
|
protected int |
getStatementType() |
Return the type of statement, something from
StatementType.
|
(package private) static FormatableBitSet |
getUpdateReadMap(DataDictionary dd,
TableDescriptor baseTable,
ResultColumnList updateColumnList,
java.util.List<ConglomerateDescriptor> conglomerates,
ConstraintDescriptorList relevantConstraints,
TriggerDescriptorList relevantTriggers,
boolean[] needsDeferredProcessing,
ColumnDescriptorList affectedGeneratedColumns) |
Builds a bitmap of all columns which should be read from the
Store in order to satisfy an UPDATE statement.
|
ConstantAction |
makeConstantAction() |
Compile constants that Execution will use
|
private void |
normalizeCorrelatedColumns(ResultColumnList rcl,
FromTable fromTable) |
|
private void |
normalizeSynonymColumns(ResultColumnList rcl,
FromTable fromTable) |
Normalize synonym column references to have the name of the base table.
|
(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)
|
protected void |
setDeferredForUpdateOfIndexColumn() |
Updates are deferred if they update a column in the index
used to scan the table being updated.
|
(package private) java.lang.String |
statementToString() |
|
private void |
tagOriginalResultSetColumns() |
Tag the original columns mentioned in the result list.
|
private void |
tagPrivilegedNodes() |
Tag all of the nodes which may require privilege checks.
|
java.lang.String |
toString() |
Convert this object to a String.
|
getUUIDofSequenceGenerator
acceptChildren, adjustDeferredFlag, bindConstraints, bindRowScopedExpression, generateCheckConstraints, generateCheckConstraints, generateCodeForTemporaryTable, generateGenerationClauses, getAffectedIndexes, getAllRelevantConstraints, getAllRelevantTriggers, getCheckConstraints, getFKInfo, getReadColMap, getResultColumnList, getResultColumnList, getSchemaDescriptor, getTriggerInfo, getXAffectedIndexes, hasCheckConstraints, hasGenerationClauses, inMatchingClause, isAtomic, markAffectedIndexes, normalizeSynonymColumns, optimizeStatement, parseAndBindGenerationClauses, parseCheckConstraint, parseGenerationClause, requiresDeferredProcessing, setRefActionInfo, setTarget, verifyTargetTable
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getResultSetNode, 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, getTableDescriptor, getTypeCompiler, getUDTDesc, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setEndOffset, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
executeSchemaName, executeStatementName, generate, getCursorInfo, getSPSName, lockTableForCompilation, needsSavepoint, updateIndexStatisticsFor
int[] changedColumnIds
boolean deferred
ValueNode checkConstraints
protected FromTable targetTable
protected FormatableBitSet readColsBitSet
protected boolean positionedUpdate
static final java.lang.String COLUMNNAME
UpdateNode(TableName targetTableName, ResultSetNode resultSet, MatchingClauseNode matchingClause, ContextManager cm)
targetTableName
- The name of the table to updateresultSet
- The ResultSet that we will generatematchingClause
- Non-null if this DML is part of a MATCHED clause of a MERGE statement.cm
- The context managerpublic java.lang.String toString()
toString
in class StatementNode
java.lang.String statementToString()
statementToString
in class DMLModStatementNode
void printSubNodes(int depth)
printSubNodes
in class DMLModStatementNode
depth
- The depth of this node in the treepublic void bindStatement() throws StandardException
Binding an update will also massage the tree so that the ResultSetNode has a set of columns to contain the old row value, followed by a set of columns to contain the new row value, followed by a column to contain the RowLocation of the row to be updated.
bindStatement
in class StatementNode
StandardException
- Thrown on errorint getPrivType()
DMLStatementNode
getPrivType
in class DMLStatementNode
private java.util.ArrayList<java.lang.String> getExplicitlySetColumns() throws StandardException
StandardException
private void associateAddedColumns() throws StandardException
StandardException
private void tagOriginalResultSetColumns() throws StandardException
StandardException
private java.util.List<ColumnReference> collectAllResultSetColumns() throws StandardException
StandardException
private java.util.List<CastNode> collectAllCastNodes() throws StandardException
StandardException
private void tagPrivilegedNodes() throws StandardException
StandardException
private void collectPrivilegedNodes(java.util.ArrayList<QueryTreeNode> result, QueryTreeNode expr) throws StandardException
StandardException
private void addUpdatePriv(java.util.ArrayList<java.lang.String> explicitlySetColumns) throws StandardException
StandardException
public boolean referencesSessionSchema() throws StandardException
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorpublic ConstantAction makeConstantAction() throws StandardException
makeConstantAction
in class QueryTreeNode
StandardException
- Thrown on failureprotected void setDeferredForUpdateOfIndexColumn()
void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- The method for the execute() method to be builtStandardException
- Thrown on errorprotected final int getStatementType()
getStatementType
in class QueryTreeNode
FormatableBitSet getReadMap(DataDictionary dd, TableDescriptor baseTable, ResultColumnList updateColumnList, ColumnDescriptorList affectedGeneratedColumns) throws StandardException
The returned map is a FormatableBitSet with 1 bit for each column in the table plus an extra, unsued 0-bit. If a 1-based column id must be read from the base table, then the corresponding 1-based bit is turned ON in the returned FormatableBitSet.
NOTE: this method is not expected to be called when all columns are being updated (i.e. updateColumnList is null).
dd
- the data dictionary to look inbaseTable
- the base table descriptorupdateColumnList
- the rcl for the update. CANNOT BE NULLaffectedGeneratedColumns
- columns whose generation clauses mention columns being updatedStandardException
- Thrown on errorprivate int[] getChangedColumnIds(ResultColumnList rcl)
static FormatableBitSet getUpdateReadMap(DataDictionary dd, TableDescriptor baseTable, ResultColumnList updateColumnList, java.util.List<ConglomerateDescriptor> conglomerates, ConstraintDescriptorList relevantConstraints, TriggerDescriptorList relevantTriggers, boolean[] needsDeferredProcessing, ColumnDescriptorList affectedGeneratedColumns) throws StandardException
dd
- Data DictionarybaseTable
- Table on which update is issuedupdateColumnList
- a list of updated columnsconglomerates
- OUT: list of affected indicesrelevantConstraints
- IN/OUT. Empty list is passed in. We hang constraints on it as we go.relevantTriggers
- IN/OUT. Passed in as an empty list. Filled in as we go.needsDeferredProcessing
- IN/OUT. true if the statement already needs
deferred processing. set while evaluating this
routine if a trigger or constraint requires
deferred processingaffectedGeneratedColumns
- columns whose generation clauses mention updated columnsStandardException
- Thrown on errorprivate static void addGeneratedColumnPrecursors(TableDescriptor baseTable, ColumnDescriptorList affectedGeneratedColumns, FormatableBitSet columnMap) throws StandardException
StandardException
private void addGeneratedColumns(TableDescriptor baseTable, ResultSetNode updateSet, ColumnDescriptorList affectedGeneratedColumns, ColumnDescriptorList addedGeneratedColumns) throws StandardException
StandardException
private void normalizeCorrelatedColumns(ResultColumnList rcl, FromTable fromTable) throws StandardException
StandardException
private void checkTableNameAndScrubResultColumns(ResultColumnList rcl) throws StandardException
StandardExcepion
- if invalid column/table is specified.StandardException
private void normalizeSynonymColumns(ResultColumnList rcl, FromTable fromTable) throws StandardException
rcl
- The result column list of the target tablefromTable
- The table name to set the column refs toStandardException
- Thrown on errorprivate void forbidGenerationOverrides(ResultColumnList targetRCL, ColumnDescriptorList addedGeneratedColumns) throws StandardException
targetRCL
- the row in the table being UPDATEdaddedGeneratedColumns
- generated columns which the compiler added
earlier onStandardException
- on errorApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.