public final class UpdateNode extends DMLModStatementNode
Modifier and Type | Field and Description |
---|---|
int[] |
changedColumnIds |
ValueNode |
checkConstraints |
static java.lang.String |
COLUMNNAME |
boolean |
deferred |
FKInfo |
fkInfo |
protected boolean |
positionedUpdate |
protected FormatableBitSet |
readColsBitSet |
protected FromTable |
targetTable |
dependentTables, fkColArrays, fkColDescriptors, fkIndexConglomNumbers, fkRefActions, fkTableNames, indexConglomerateNumbers, indexNames, indicesToMaintain, isDependentTable, lockMode, relevantCdl, relevantTriggers, resultColumnList, synonymTableName, targetTableDescriptor, targetTableName, targetVTI, triggerInfo
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
Constructor and Description |
---|
UpdateNode() |
Modifier and Type | Method and 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.
|
void |
bindStatement()
Bind this UpdateNode.
|
private void |
checkTableNameAndScrubResultColumns(ResultColumnList rcl)
Check table name and then clear it from the result set columns.
|
private void |
forbidGenerationOverrides(ResultColumnList targetRCL,
ColumnDescriptorList addedGeneratedColumns)
Do not allow generation clauses to be overriden.
|
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Code generation for update.
|
private int[] |
getChangedColumnIds(ResultColumnList rcl)
Construct the changedColumnIds array.
|
(package private) int |
getPrivType()
Return default privilege needed for this node.
|
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.
|
static FormatableBitSet |
getUpdateReadMap(DataDictionary dd,
TableDescriptor baseTable,
ResultColumnList updateColumnList,
java.util.List conglomVector,
ConstraintDescriptorList relevantConstraints,
GenericDescriptorList 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.
|
void |
init(java.lang.Object targetTableName,
java.lang.Object resultSet)
Initializer for an UpdateNode.
|
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.
|
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.
|
java.lang.String |
statementToString() |
java.lang.String |
toString()
Convert this object to a String.
|
acceptChildren, adjustDeferredFlag, bindConstraints, bindRowScopedExpression, generateCheckConstraints, generateCheckConstraints, generateCodeForTemporaryTable, generateGenerationClauses, getAffectedIndexes, getAllRelevantConstraints, getAllRelevantTriggers, getCheckConstraints, getFKInfo, getReadColMap, getResultColumnList, getResultColumnList, getSchemaDescriptor, getTriggerInfo, getXAffectedIndexes, hasCheckConstraints, hasGenerationClauses, init, isAtomic, markAffectedIndexes, normalizeSynonymColumns, optimizeStatement, parseAndBindGenerationClauses, parseCheckConstraint, parseGenerationClause, requiresDeferredProcessing, setRefActionInfo, setTarget, verifyTargetTable
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getResultSetNode, makeResultDescription
executeSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilation, needsSavepoint, updateIndexStatisticsFor
accept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, stackPrint, treePrint, treePrint, verifyClassExist
public int[] changedColumnIds
public boolean deferred
public ValueNode checkConstraints
public FKInfo fkInfo
protected FromTable targetTable
protected FormatableBitSet readColsBitSet
protected boolean positionedUpdate
public static final java.lang.String COLUMNNAME
public void init(java.lang.Object targetTableName, java.lang.Object resultSet)
init
in interface Node
init
in class DMLModStatementNode
targetTableName
- The name of the table to updateresultSet
- The ResultSet that will generate
the rows to update from the given tablepublic java.lang.String toString()
toString
in class StatementNode
public java.lang.String statementToString()
statementToString
in class DMLModStatementNode
public 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
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()
public 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
public 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)
public static FormatableBitSet getUpdateReadMap(DataDictionary dd, TableDescriptor baseTable, ResultColumnList updateColumnList, java.util.List conglomVector, ConstraintDescriptorList relevantConstraints, GenericDescriptorList relevantTriggers, boolean[] needsDeferredProcessing, ColumnDescriptorList affectedGeneratedColumns) throws StandardException
dd
- Data DictionarybaseTable
- Table on which update is issuedupdateColumnList
- a list of updated columnsconglomVector
- OUT: vector 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.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.