class DeleteNode extends DMLModStatementNode
Modifier and Type | Field and Description |
---|---|
private boolean |
cascadeDelete |
private static java.lang.String |
COLUMNNAME |
private boolean |
deferred |
private ConstantAction[] |
dependentConstantActions |
private StatementNode[] |
dependentNodes |
private FormatableBitSet |
readColsBitSet |
private FromTable |
targetTable |
dependentTables, fkColArrays, fkColDescriptors, fkIndexConglomNumbers, fkInfo, fkRefActions, fkTableNames, indexConglomerateNumbers, indexNames, indicesToMaintain, isDependentTable, lockMode, matchingClause, 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_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor and Description |
---|
DeleteNode(TableName targetTableName,
ResultSetNode queryExpression,
MatchingClauseNode matchingClause,
ContextManager cm)
Constructor for a DeleteNode.
|
Modifier and Type | Method and Description |
---|---|
void |
bindStatement()
Bind this DeleteNode.
|
private void |
correlateAddedColumns(ResultColumnList rcl,
FromTable fromTable) |
(package private) void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Code generation for delete.
|
private static FormatableBitSet |
getDeleteReadMap(TableDescriptor baseTable,
java.util.List<ConglomerateDescriptor> conglomerates,
TriggerDescriptorList relevantTriggers,
boolean[] needsDeferredProcessing)
Builds a bitmap of all columns which should be read from the
Store in order to satisfy an DELETE statement.
1) finds all indices on this table
2) adds the index columns to a bitmap of affected columns
3) adds the index descriptors to a list of conglomerate
descriptors.
4) finds all DELETE triggers on the table
5) if there are any DELETE triggers, then do one of the following
a)If all of the triggers have MISSING referencing clause, then that
means that the trigger actions do not have access to before and
after values.
|
private StatementNode |
getDependentTableNode(java.lang.String tableName,
int refAction,
ColumnDescriptorList cdl)
In case of referential actions, we require to perform
DML (UPDATE or DELETE) on the dependent tables.
|
private DeleteNode |
getEmptyDeleteNode(java.lang.String schemaName,
java.lang.String targetTableName) |
private UpdateNode |
getEmptyUpdateNode(java.lang.String schemaName,
java.lang.String targetTableName,
ColumnDescriptorList cdl) |
(package private) int |
getPrivType()
Return default privilege needed for this node.
|
FormatableBitSet |
getReadMap(DataDictionary dd,
TableDescriptor baseTable)
Gets the map of all columns which must be read out of the base table.
|
private ResultColumnList |
getSetClause(ColumnDescriptorList cdl) |
protected int |
getStatementType()
Return the type of statement, something from
StatementType.
|
ConstantAction |
makeConstantAction()
Compile constants that Execution will use
|
void |
optimizeStatement()
Generate an optimized QueryTree from a bound QueryTree.
|
boolean |
referencesSessionSchema()
Return true if the node references SESSION schema tables (temporary or permanent)
|
(package private) java.lang.String |
statementToString() |
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, parseAndBindGenerationClauses, parseCheckConstraint, parseGenerationClause, printSubNodes, requiresDeferredProcessing, setRefActionInfo, setTarget, verifyTargetTable
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getResultSetNode, makeResultDescription
executeSchemaName, executeStatementName, generate, getCursorInfo, getSPSName, lockTableForCompilation, needsSavepoint, toString, updateIndexStatisticsFor
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
private static final java.lang.String COLUMNNAME
private boolean deferred
private FromTable targetTable
private FormatableBitSet readColsBitSet
private ConstantAction[] dependentConstantActions
private boolean cascadeDelete
private StatementNode[] dependentNodes
DeleteNode(TableName targetTableName, ResultSetNode queryExpression, MatchingClauseNode matchingClause, ContextManager cm)
targetTableName
- The name of the table to delete fromqueryExpression
- The query expression that will generate
the rows to delete from the given tablematchingClause
- Non-null if this DML is part of a MATCHED clause of a MERGE statement.cm
- The context managerjava.lang.String statementToString()
statementToString
in class DMLModStatementNode
public void bindStatement() throws StandardException
If any indexes need to be updated, we add all the columns in the base table to the result column list, so that we can use the column values as look-up keys for the index rows to be deleted. Binding a delete will also massage the tree so that the ResultSetNode has column containing the RowLocation of the base row.
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 failurevoid generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- The execute() method to be builtStandardException
- Thrown on errorprotected final int getStatementType()
getStatementType
in class QueryTreeNode
public FormatableBitSet getReadMap(DataDictionary dd, TableDescriptor baseTable) throws StandardException
dd
- the data dictionary to look inbaseTable
- the base table descriptorStandardException
- Thrown on errorprivate StatementNode getDependentTableNode(java.lang.String tableName, int refAction, ColumnDescriptorList cdl) throws StandardException
StandardException
private DeleteNode getEmptyDeleteNode(java.lang.String schemaName, java.lang.String targetTableName) throws StandardException
StandardException
private UpdateNode getEmptyUpdateNode(java.lang.String schemaName, java.lang.String targetTableName, ColumnDescriptorList cdl) throws StandardException
StandardException
private ResultColumnList getSetClause(ColumnDescriptorList cdl) throws StandardException
StandardException
public void optimizeStatement() throws StandardException
DMLModStatementNode
optimizeStatement
in class DMLModStatementNode
StandardException
- Thrown on failureprivate static FormatableBitSet getDeleteReadMap(TableDescriptor baseTable, java.util.List<ConglomerateDescriptor> conglomerates, TriggerDescriptorList relevantTriggers, boolean[] needsDeferredProcessing) throws StandardException
conglomerates
- OUT: list of affected indicesrelevantTriggers
- 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 requires
deferred processingStandardException
- Thrown on errorprivate void correlateAddedColumns(ResultColumnList rcl, FromTable fromTable) throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.