VisitableDeleteNode, DMLModGeneratedColumnsStatementNode, MergeNodeabstract class DMLModStatementNode extends DMLStatementNode
resultSetAUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEXEMPTY_TD_LIST, NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATION| Constructor | Description |
|---|---|
DMLModStatementNode(ResultSetNode resultSet,
MatchingClauseNode matchingClause,
int statementType,
ContextManager cm) |
Constructor for a DMLModStatementNode -- delegate to DMLStatementNode
|
DMLModStatementNode(ResultSetNode resultSet,
MatchingClauseNode matchingClause,
ContextManager cm) |
| Modifier and Type | Method | Description |
|---|---|---|
(package private) void |
acceptChildren(Visitor v) |
Accept the visitor for all visitable children of this node.
|
protected void |
adjustDeferredFlag(boolean adjustment) |
|
(package private) ValueNode |
bindConstraints(DataDictionary dataDictionary,
OptimizerFactory optimizerFactory,
TableDescriptor targetTableDescriptor,
Dependent dependent,
ResultColumnList sourceRCL,
int[] changedColumnIds,
FormatableBitSet readColsBitSet,
boolean includeTriggers,
boolean[] hasDeferrableCheckConstraints) |
Gets and binds all the constraints for an INSERT/UPDATE/DELETE.
|
(package private) static void |
bindRowScopedExpression(OptimizerFactory optimizerFactory,
ContextManager cm,
TableDescriptor targetTableDescriptor,
ResultColumnList sourceRCL,
ValueNode expression) |
Binds an already parsed expression that only involves columns in a single
row.
|
private void |
createConstraintDependencies(DataDictionary dd,
ConstraintDescriptorList cdl,
Dependent dependent) |
Get all of our dependents due to a constraint.
|
private void |
createTriggerDependencies(TriggerDescriptorList tdl,
Dependent dependent) |
Makes the calling object (usually a Statement) dependent on all the constraints.
|
private void |
fkSetupArrays(DataDictionary dd,
ForeignKeyConstraintDescriptor fkcd,
int index,
UUID[] uuids,
long[] conglomNumbers,
java.lang.String[] fkNames,
boolean[] isSelfReferencingFK,
int[] raRules,
boolean[] isDeferrable,
UUID[] fkIds) |
|
MethodBuilder |
generateCheckConstraints(ValueNode checkConstraints,
ExpressionClassBuilder ecb) |
Generate a method to evaluate a tree of CHECK CONSTRAINTS.
|
void |
generateCheckConstraints(ValueNode checkConstraints,
ExpressionClassBuilder ecb,
MethodBuilder mb) |
Generate the code to evaluate a tree of CHECK CONSTRAINTS.
|
private ValueNode |
generateCheckTree(ConstraintDescriptorList cdl,
TableDescriptor td,
boolean[] hasDeferrable) |
Get the ANDing of all appropriate check constraints as 1 giant query tree.
|
protected void |
generateCodeForTemporaryTable(ActivationClassBuilder acb) |
If the DML is on a temporary table, generate the code to mark temporary table as modified in the current UOW.
|
private void |
generateFKInfo(ConstraintDescriptorList cdl,
DataDictionary dd,
TableDescriptor td,
FormatableBitSet readColsBitSet) |
Generate the FKInfo structures used during code generation.
|
private MethodBuilder |
generateGenerationClauses(ResultColumnList rcl,
int rsNumber,
boolean isUpdate,
ExpressionClassBuilder ecb) |
Generate a method to compute all of the generation clauses in a row.
|
void |
generateGenerationClauses(ResultColumnList rcl,
int resultSetNumber,
boolean isUpdate,
ExpressionClassBuilder ecb,
MethodBuilder mb) |
Generate the code to evaluate all of the generation clauses.
|
private void |
generateTriggerInfo(TriggerDescriptorList triggerList) |
Generate the TriggerInfo structures used during code generation.
|
protected void |
getAffectedIndexes(TableDescriptor td,
ResultColumnList updatedColumns,
FormatableBitSet colBitSet) |
Get the list of indexes that must be updated by this DML statement.
|
protected ConstraintDescriptorList |
getAllRelevantConstraints(DataDictionary dd,
TableDescriptor td,
int[] changedColumnIds) |
Get all the constraints relevant to this DML operation
|
protected TriggerDescriptorList |
getAllRelevantTriggers(DataDictionary dd,
TableDescriptor td,
int[] changedColumnIds,
boolean includeTriggers) |
Get all the triggers relevant to this DML operation
|
(package private) ValueNode |
getCheckConstraints() |
Get the check constraints for this node
|
(package private) FKInfo[] |
getFKInfo() |
Return the FKInfo structure.
|
(package private) static int[] |
getReadColMap(int column_map_length,
FormatableBitSet readColsBitSet) |
Get a map to efficiently find heap columns from a compressed set of
read columns.
|
protected void |
getResultColumnList() |
Get and bind the ResultColumnList representing the columns in the
target table, given the table's name.
|
private void |
getResultColumnList(FromBaseTable fromBaseTable,
ResultColumnList inputRcl) |
Get and bind the ResultColumnList representing the columns in the
target table, given a FromTable for the target table.
|
protected FromBaseTable |
getResultColumnList(ResultColumnList inputRcl) |
Get and bind the ResultColumnList representing the columns in the
target table, given the table's name.
|
private int[] |
getRowMap(FormatableBitSet bitSet,
TableDescriptor td) |
Get a integer based row map from a bit set.
|
(package private) SchemaDescriptor |
getSchemaDescriptor() |
Get a schema descriptor for the given table.
|
(package private) TriggerInfo |
getTriggerInfo() |
Return the TriggerInfo structure.
|
(package private) static void |
getXAffectedIndexes(TableDescriptor baseTable,
ResultColumnList updatedColumns,
FormatableBitSet colBitSet,
java.util.List<ConglomerateDescriptor> conglomerates) |
Marks which indexes are affected by an UPDATE of the
desired shape.
|
protected boolean |
hasCheckConstraints(DataDictionary dd,
TableDescriptor td) |
Determine whether or not there are check constraints on the
specified table.
|
protected boolean |
hasGenerationClauses(TableDescriptor td) |
Determine whether or not there are generated columns in the
specified table.
|
boolean |
inMatchingClause() |
Returns true if this DMLModStatement a [ NOT ] MATCHED action of a MERGE statement
|
boolean |
isAtomic() |
INSERT/UPDATE/DELETE are always atomic.
|
protected void |
markAffectedIndexes(java.util.List<ConglomerateDescriptor> affectedConglomerates) |
|
(package private) void |
normalizeSynonymColumns(ResultColumnList rcl,
TableName targetTableName) |
Normalize synonym column references to have the name of the base table.
|
void |
optimizeStatement() |
Generate an optimized QueryTree from a bound QueryTree.
|
(package private) void |
parseAndBindGenerationClauses(DataDictionary dataDictionary,
TableDescriptor targetTableDescriptor,
ResultColumnList sourceRCL,
ResultColumnList targetRCL,
boolean forUpdate,
ResultSetNode updateResultSet) |
Parse and bind the generating expressions of computed columns.
|
ValueNode |
parseCheckConstraint(java.lang.String checkConstraintText,
TableDescriptor td) |
Parse a check constraint and turn it into a query tree.
|
ValueNode |
parseGenerationClause(java.lang.String clauseText,
TableDescriptor td) |
Parse the generation clause for a column.
|
(package private) void |
printSubNodes(int depth) |
Prints the sub-nodes of this object.
|
private int[] |
remapReferencedColumns(ConstraintDescriptor cd,
int[] rowMap) |
Remap referenced columns in the cd to reflect the
passed in row map.
|
(package private) boolean |
requiresDeferredProcessing() |
Does this DML Node require deferred processing?
|
(package private) void |
setRefActionInfo(long fkIndexConglomId,
int[] fkColArray,
java.lang.String parentResultSetId,
boolean dependentScan) |
set the Information gathered from the parent table that is
required to perform a referential action on dependent table.
|
(package private) void |
setTarget(QueryTreeNode targetName) |
|
(package private) java.lang.String |
statementToString() |
|
(package private) void |
verifyTargetTable() |
Verify the target table.
|
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getPrivType, getResultSetNode, makeResultDescriptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaccept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generate, 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, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, stackPrint, taggedWith, treePrint, treePrint, verifyClassExistbindStatement, executeSchemaName, executeStatementName, generate, getCursorInfo, getSPSName, lockTableForCompilation, needsSavepoint, toString, updateIndexStatisticsForprotected FromVTI targetVTI
protected TableName targetTableName
protected ResultColumnList resultColumnList
protected int lockMode
protected FKInfo[] fkInfo
protected TriggerInfo triggerInfo
TableDescriptor targetTableDescriptor
public IndexRowGenerator[] indicesToMaintain
public long[] indexConglomerateNumbers
public java.lang.String[] indexNames
protected ConstraintDescriptorList relevantCdl
protected TriggerDescriptorList relevantTriggers
private boolean requiresDeferredProcessing
private int statementType
private boolean bound
private ValueNode checkConstraints
protected java.lang.String[] fkSchemaNames
protected java.lang.String[] fkTableNames
protected int[] fkRefActions
protected ColumnDescriptorList[] fkColDescriptors
protected long[] fkIndexConglomNumbers
protected boolean isDependentTable
protected int[][] fkColArrays
protected TableName synonymTableName
protected MatchingClauseNode matchingClause
java.util.Set<java.lang.String> dependentTables
DMLModStatementNode(ResultSetNode resultSet, MatchingClauseNode matchingClause, ContextManager cm)
DMLModStatementNode(ResultSetNode resultSet, MatchingClauseNode matchingClause, int statementType, ContextManager cm)
resultSet - A ResultSetNode for the result set of the
DML statementmatchingClause - Non-null if this DML is part of a MATCHED clause of a MERGE statement.statementType - used by nodes that allocate a DMLMod directly
(rather than inheriting it).cm - The context managerpublic boolean inMatchingClause()
void setTarget(QueryTreeNode targetName)
protected void generateCodeForTemporaryTable(ActivationClassBuilder acb) throws StandardException
acb - The ActivationClassBuilder for the class being builtStandardException - Thrown on errorvoid verifyTargetTable()
throws StandardException
StandardException - Thrown on errorpublic boolean isAtomic()
isAtomic in class DMLStatementNodeSchemaDescriptor getSchemaDescriptor() throws StandardException
StandardException - throws on schema name
that doesn't existstatic int[] getReadColMap(int column_map_length,
FormatableBitSet readColsBitSet)
map[heapColId (0 based)] -> readCol id (0 based)
column_map_length - The number of columns(ints) in the map.readColsBitSet - A language style (1 based) bit set with bits for
read heap columns set.
RESOLVE: Replace this with a call to RowUtil when the store and
the language both use 0 base or 1 base offsets for columns. Today
we can't use the store function because we have a 1 based FormatableBitSet.protected void getResultColumnList()
throws StandardException
StandardException - Thrown on errorprotected FromBaseTable getResultColumnList(ResultColumnList inputRcl) throws StandardException
StandardException - Thrown on errorprivate void getResultColumnList(FromBaseTable fromBaseTable, ResultColumnList inputRcl) throws StandardException
StandardException - Thrown on errorvoid parseAndBindGenerationClauses(DataDictionary dataDictionary, TableDescriptor targetTableDescriptor, ResultColumnList sourceRCL, ResultColumnList targetRCL, boolean forUpdate, ResultSetNode updateResultSet) throws StandardException
dataDictionary - metadatatargetTableDescriptor - metadata for the table that has the generated columnssourceRCL - the tuple stream which drives the INSERT or UPDATEtargetRCL - the row in the table that's being INSERTed or UPDATEdforUpdate - true if this is an UPDATE. false otherwise.updateResultSet - more information on the tuple stream driving the UPDATEStandardExceptionpublic ValueNode parseGenerationClause(java.lang.String clauseText, TableDescriptor td) throws StandardException
clauseText - Text of the generation clauseStandardException - Thrown on failureValueNode bindConstraints(DataDictionary dataDictionary, OptimizerFactory optimizerFactory, TableDescriptor targetTableDescriptor, Dependent dependent, ResultColumnList sourceRCL, int[] changedColumnIds, FormatableBitSet readColsBitSet, boolean includeTriggers, boolean[] hasDeferrableCheckConstraints) throws StandardException
dataDictionary - The DataDictionarytargetTableDescriptor - The TableDescriptordependent - Parent object that will depend on all the constraints
that we look up. If this argument is null, then we
use the default dependent (the statement being compiled).sourceRCL - RCL of the table being changedchangedColumnIds - If null, all columns being changed, otherwise array
of 1-based column ids for columns being changedreadColsBitSet - bit set for the read scanincludeTriggers - whether triggers are included in the processinghasDeferrableCheckConstraints - OUT semantics: set element 0 to true if the
target table has any deferrable CHECK constraintsStandardException - Thrown on failurestatic void bindRowScopedExpression(OptimizerFactory optimizerFactory, ContextManager cm, TableDescriptor targetTableDescriptor, ResultColumnList sourceRCL, ValueNode expression) throws StandardException
optimizerFactory - The optimizer factorycm - The context managertargetTableDescriptor - The TableDescriptor for the constrained
tablesourceRCL - Result columnsexpression - Parsed query tree for row scoped expressionStandardException - Thrown on failureprotected boolean hasCheckConstraints(DataDictionary dd, TableDescriptor td) throws StandardException
dd - The DataDictionary to usetd - The TableDescriptor for the tableStandardException - Thrown on failureprotected boolean hasGenerationClauses(TableDescriptor td) throws StandardException
td - The TableDescriptor for the tableStandardException - Thrown on failureprivate ValueNode generateCheckTree(ConstraintDescriptorList cdl, TableDescriptor td, boolean[] hasDeferrable) throws StandardException
cdl - The constraint descriptor listtd - The TableDescriptorStandardException - Thrown on failureprivate void generateFKInfo(ConstraintDescriptorList cdl, DataDictionary dd, TableDescriptor td, FormatableBitSet readColsBitSet) throws StandardException
cdl - The constraint descriptor listdd - The DataDictionarytd - The TableDescriptorreadColsBitSet - columns readStandardException - Thrown on failureprivate void fkSetupArrays(DataDictionary dd, ForeignKeyConstraintDescriptor fkcd, int index, UUID[] uuids, long[] conglomNumbers, java.lang.String[] fkNames, boolean[] isSelfReferencingFK, int[] raRules, boolean[] isDeferrable, UUID[] fkIds) throws StandardException
StandardExceptionprivate void generateTriggerInfo(TriggerDescriptorList triggerList)
triggerList - The trigger descriptor listFKInfo[] getFKInfo()
TriggerInfo getTriggerInfo()
ValueNode getCheckConstraints()
private void createTriggerDependencies(TriggerDescriptorList tdl, Dependent dependent) throws StandardException
tdl - The trigger descriptor listdependent - Parent object that will depend on all the constraints
that we look up. If this argument is null, then we
use the default dependent (the statement being compiled).StandardException - Thrown on failureprotected TriggerDescriptorList getAllRelevantTriggers(DataDictionary dd, TableDescriptor td, int[] changedColumnIds, boolean includeTriggers) throws StandardException
dd - The data dictionarytd - The TableDescriptorchangedColumnIds - If null, all columns being changed, otherwise array
of 1-based column ids for columns being changedincludeTriggers - whether we allow trigger processing or not for
this tableStandardException - Thrown on failureprotected void adjustDeferredFlag(boolean adjustment)
private void createConstraintDependencies(DataDictionary dd, ConstraintDescriptorList cdl, Dependent dependent) throws StandardException
dd - The data dictionarycdl - The constraint descriptor listdependent - Parent object that will depend on all the constraints
that we look up. If this argument is null, then we
use the default dependent (the statement being compiled).StandardException - Thrown on failureprotected ConstraintDescriptorList getAllRelevantConstraints(DataDictionary dd, TableDescriptor td, int[] changedColumnIds) throws StandardException
dd - The DataDictionarytd - The TableDescriptorchangedColumnIds - If null, all columns being changed, otherwise array
of 1-based column ids for columns being changedStandardException - Thrown on failureboolean requiresDeferredProcessing()
public ValueNode parseCheckConstraint(java.lang.String checkConstraintText, TableDescriptor td) throws StandardException
checkConstraintText - Text of CHECK CONSTRAINT.td - The TableDescriptor for the table the the constraint is on.StandardException - Thrown on failurepublic void generateCheckConstraints(ValueNode checkConstraints, ExpressionClassBuilder ecb, MethodBuilder mb) throws StandardException
checkConstraints - Bound query tree of ANDed check constraints.ecb - Expression Class BuilderStandardException - Thrown on errorpublic MethodBuilder generateCheckConstraints(ValueNode checkConstraints, ExpressionClassBuilder ecb) throws StandardException
checkConstraints - Bound query tree of ANDed check constraints.ecb - Expression Class BuilderStandardException - Thrown on errorpublic void generateGenerationClauses(ResultColumnList rcl, int resultSetNumber, boolean isUpdate, ExpressionClassBuilder ecb, MethodBuilder mb) throws StandardException
rcl - describes the row of expressions to be put into the bas tableresultSetNumber - index of base table into array of ResultSetsisUpdate - true if this is for an UPDATE statementecb - code generation state variablemb - the method being generatedStandardException - Thrown on errorprivate MethodBuilder generateGenerationClauses(ResultColumnList rcl, int rsNumber, boolean isUpdate, ExpressionClassBuilder ecb) throws StandardException
rcl - describes the row of expressions to be put into the bas tablersNumber - index of base table into array of ResultSetsisUpdate - true if this is for an UPDATE statementecb - code generation state variableStandardExceptionpublic void optimizeStatement()
throws StandardException
optimizeStatement in class DMLStatementNodeStandardException - Thrown on failureprotected void getAffectedIndexes(TableDescriptor td, ResultColumnList updatedColumns, FormatableBitSet colBitSet) throws StandardException
td - The table descriptor for the table being updatedupdatedColumns - The updated column list. If not update, nullcolBitSet - a 1 based bit set of the columns in the listStandardException - Thrown on errorstatic void getXAffectedIndexes(TableDescriptor baseTable, ResultColumnList updatedColumns, FormatableBitSet colBitSet, java.util.List<ConglomerateDescriptor> conglomerates) throws StandardException
updatedColumns - a list of updated columnscolBitSet - OUT: evolving bitmap of affected columnsconglomerates - OUT: list of affected indicesStandardException - Thrown on errorprotected void markAffectedIndexes(java.util.List<ConglomerateDescriptor> affectedConglomerates) throws StandardException
StandardExceptionjava.lang.String statementToString()
statementToString in class StatementNodeprivate int[] remapReferencedColumns(ConstraintDescriptor cd, int[] rowMap)
cd - constraint descriptorrowMap - 1 based row mapprivate int[] getRowMap(FormatableBitSet bitSet, TableDescriptor td) throws StandardException
bitSet - td - StandardExceptionvoid setRefActionInfo(long fkIndexConglomId,
int[] fkColArray,
java.lang.String parentResultSetId,
boolean dependentScan)
QueryTreeNodesetRefActionInfo in class QueryTreeNodevoid normalizeSynonymColumns(ResultColumnList rcl, TableName targetTableName) throws StandardException
rcl - The result column list of the target tabletargetTableName - The target tablenameStandardException - Thrown on errorvoid printSubNodes(int depth)
printSubNodes in class DMLStatementNodedepth - The depth of this node in the treevoid acceptChildren(Visitor v) throws StandardException
acceptChildren in class DMLStatementNodev - the visitorStandardException - on errorApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.