Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv abstract Class DMLModStatementNode

extends DMLStatementNode
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.compile.MergeNode, org.apache.derby.impl.sql.compile.DeleteNode, org.apache.derby.impl.sql.compile.DMLModGeneratedColumnsStatementNode
Imports
java.util.ArrayList, .List, .Set, org.apache.derby.catalog.DefaultInfo, .UUID, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, .SQLState, org.apache.derby.iapi.services.classfile.VMOpcode, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.sql.StatementType, org.apache.derby.iapi.sql.compile.CompilerContext, .OptimizerFactory, .Parser, .Visitable, .Visitor, org.apache.derby.iapi.sql.conn.Authorizer, .LanguageConnectionContext, org.apache.derby.iapi.sql.depend.Dependent, org.apache.derby.iapi.sql.dictionary.ColumnDescriptor, .ColumnDescriptorList, .ConglomerateDescriptor, .ConstraintDescriptor, .ConstraintDescriptorList, .DataDictionary, .ForeignKeyConstraintDescriptor, .IndexRowGenerator, .ReferencedKeyConstraintDescriptor, .SchemaDescriptor, .TableDescriptor, .TriggerDescriptor, .TriggerDescriptorList, org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.types.DataTypeDescriptor, org.apache.derby.impl.sql.execute.FKInfo, .TriggerInfo, org.apache.derby.shared.common.sanity.SanityManager

A DMLStatement for a table modification: to wit, INSERT UPDATE or DELETE.

Field Summary

Modifier and TypeField and Description
private boolean
private ValueNode
pack-priv Set<String>
dependentTables

Set of dependent tables for cascading deletes.

protected int[][]
protected ColumnDescriptorList[]
protected long[]
protected FKInfo[]
protected int[]
protected String[]
protected String[]
public long[]
public String[]
public IndexRowGenerator[]
protected boolean
protected int
protected MatchingClauseNode
protected ConstraintDescriptorList
protected TriggerDescriptorList
private boolean
protected ResultColumnList
private int
protected TableName
pack-priv TableDescriptor
protected TableName
protected FromVTI
protected TriggerInfo
Inherited from org.apache.derby.impl.sql.compile.DMLStatementNode:
resultSet

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
DMLModStatementNode(ResultSetNode
A ResultSetNode for the result set of the DML statement
resultSet
,
MatchingClauseNode
Non-null if this DML is part of a MATCHED clause of a MERGE statement.
matchingClause
,
int
used by nodes that allocate a DMLMod directly (rather than inheriting it).
statementType
,
ContextManager
The context manager
cm
)

Constructor for a DMLModStatementNode -- delegate to DMLStatementNode

Method Summary

Modifier and TypeMethod and Description
pack-priv void
acceptChildren(Visitor
the visitor
v
)

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.acceptChildren.

Accept the visitor for all visitable children of this node.

protected void
adjustDeferredFlag(boolean adjustment)

pack-priv ValueNode

Returns:

The bound, ANDed check constraints as a query tree.
bindConstraints
(DataDictionary
The DataDictionary
dataDictionary
,
OptimizerFactory optimizerFactory, TableDescriptor
The TableDescriptor
targetTableDescriptor
,
Dependent
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).
dependent
,
ResultColumnList
RCL of the table being changed
sourceRCL
,
int[]
If null, all columns being changed, otherwise array of 1-based column ids for columns being changed
changedColumnIds
,
FormatableBitSet
bit set for the read scan
readColsBitSet
,
boolean
whether triggers are included in the processing
includeTriggers
,
boolean[]
OUT semantics: set element 0 to true if the target table has any deferrable CHECK constraints
hasDeferrableCheckConstraints
)

Gets and binds all the constraints for an INSERT/UPDATE/DELETE.

pack-priv static void
bindRowScopedExpression(OptimizerFactory
The optimizer factory
optimizerFactory
,
ContextManager
The context manager
cm
,
TableDescriptor
The TableDescriptor for the constrained table
targetTableDescriptor
,
ResultColumnList
Result columns
sourceRCL
,
ValueNode
Parsed query tree for row scoped expression
expression
)

Binds an already parsed expression that only involves columns in a single row.

private void
createConstraintDependencies(DataDictionary
The data dictionary
dd
,
ConstraintDescriptorList
The constraint descriptor list
cdl
,
Dependent
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).
dependent
)

Get all of our dependents due to a constraint.

private void
createTriggerDependencies(TriggerDescriptorList
The trigger descriptor list
tdl
,
Dependent
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).
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, String[] fkNames, boolean[] isSelfReferencingFK, int[] raRules, boolean[] isDeferrable, UUID[] fkIds)

public void
generateCheckConstraints(ValueNode
Bound query tree of ANDed check constraints.
checkConstraints
,
ExpressionClassBuilder
Expression Class Builder
ecb
,
MethodBuilder mb)

Generate the code to evaluate a tree of CHECK CONSTRAINTS.

public MethodBuilder
generateCheckConstraints(ValueNode
Bound query tree of ANDed check constraints.
checkConstraints
,
ExpressionClassBuilder
Expression Class Builder
ecb
)

Generate a method to evaluate a tree of CHECK CONSTRAINTS.

private ValueNode

Returns:

The ANDing of all appropriate check constraints as a query tree.
generateCheckTree
(ConstraintDescriptorList
The constraint descriptor list
cdl
,
TableDescriptor
The TableDescriptor
td
,
boolean[] hasDeferrable)

Get the ANDing of all appropriate check constraints as 1 giant query tree.

protected void
generateCodeForTemporaryTable(ActivationClassBuilder
The ActivationClassBuilder for the class being built
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
The constraint descriptor list
cdl
,
DataDictionary
The DataDictionary
dd
,
TableDescriptor
The TableDescriptor
td
,
FormatableBitSet
columns read
readColsBitSet
)

Generate the FKInfo structures used during code generation.

public void
generateGenerationClauses(ResultColumnList
describes the row of expressions to be put into the bas table
rcl
,
int
index of base table into array of ResultSets
resultSetNumber
,
boolean
true if this is for an UPDATE statement
isUpdate
,
ExpressionClassBuilder
code generation state variable
ecb
,
MethodBuilder
the method being generated
mb
)

Generate the code to evaluate all of the generation clauses.

private MethodBuilder
generateGenerationClauses(ResultColumnList
describes the row of expressions to be put into the bas table
rcl
,
int
index of base table into array of ResultSets
rsNumber
,
boolean
true if this is for an UPDATE statement
isUpdate
,
ExpressionClassBuilder
code generation state variable
ecb
)

Generate a method to compute all of the generation clauses in a row.

private void
generateTriggerInfo(TriggerDescriptorList
The trigger descriptor list
triggerList
)

Generate the TriggerInfo structures used during code generation.

protected void
getAffectedIndexes(TableDescriptor
The table descriptor for the table being updated
td
,
ResultColumnList
The updated column list. If not update, null
updatedColumns
,
FormatableBitSet
a 1 based bit set of the columns in the list
colBitSet
)

Get the list of indexes that must be updated by this DML statement.

protected ConstraintDescriptorList

Returns:

the constraint descriptor list
getAllRelevantConstraints
(DataDictionary
The DataDictionary
dd
,
TableDescriptor
The TableDescriptor
td
,
int[]
If null, all columns being changed, otherwise array of 1-based column ids for columns being changed
changedColumnIds
)

Get all the constraints relevant to this DML operation

protected TriggerDescriptorList

Returns:

the constraint descriptor list
getAllRelevantTriggers
(DataDictionary
The data dictionary
dd
,
TableDescriptor
The TableDescriptor
td
,
int[]
If null, all columns being changed, otherwise array of 1-based column ids for columns being changed
changedColumnIds
,
boolean
whether we allow trigger processing or not for this table
includeTriggers
)

Get all the triggers relevant to this DML operation

pack-priv ValueNode

Returns:

the check constraints, may be null
getCheckConstraints
()

Get the check constraints for this node

pack-priv FKInfo[]

Returns:

the array of fkinfos
getFKInfo
()

Return the FKInfo structure.

pack-priv static int[]
getReadColMap(int
The number of columns(ints) in the map.
column_map_length
,
FormatableBitSet
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.

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.

protected FromBaseTable
getResultColumnList(ResultColumnList inputRcl)

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.

private int[]
getRowMap(FormatableBitSet bitSet, TableDescriptor td)

Get a integer based row map from a bit set.

pack-priv SchemaDescriptor

Returns:

Schema Descriptor
getSchemaDescriptor
()

Get a schema descriptor for the given table.

pack-priv TriggerInfo

Returns:

the trigger info
getTriggerInfo
()

Return the TriggerInfo structure.

pack-priv static void
getXAffectedIndexes(TableDescriptor baseTable, ResultColumnList
a list of updated columns
updatedColumns
,
FormatableBitSet
OUT: evolving bitmap of affected columns
colBitSet
,
List<ConglomerateDescriptor>
OUT: list of affected indices
conglomerates
)

Marks which indexes are affected by an UPDATE of the desired shape.

protected boolean

Returns:

Whether or not there are check constraints on the specified table.
hasCheckConstraints
(DataDictionary
The DataDictionary to use
dd
,
TableDescriptor
The TableDescriptor for the table
td
)

Determine whether or not there are check constraints on the specified table.

protected boolean

Returns:

Whether or not there are generated columns in the specified table.
hasGenerationClauses
(TableDescriptor
The TableDescriptor for the table
td
)

Determine whether or not there are generated columns in the specified table.

public boolean
inMatchingClause()

Returns true if this DMLModStatement a [ NOT ] MATCHED action of a MERGE statement

public boolean

Returns:

true
isAtomic
()

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.isAtomic.

INSERT/UPDATE/DELETE are always atomic.

protected void
pack-priv void
normalizeSynonymColumns(ResultColumnList
The result column list of the target table
rcl
,
TableName
The target tablename
targetTableName
)

Normalize synonym column references to have the name of the base table.

public void
optimizeStatement()

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement.

Generate an optimized QueryTree from a bound QueryTree.

pack-priv void
parseAndBindGenerationClauses(DataDictionary
metadata
dataDictionary
,
TableDescriptor
metadata for the table that has the generated columns
targetTableDescriptor
,
ResultColumnList
the tuple stream which drives the INSERT or UPDATE
sourceRCL
,
ResultColumnList
the row in the table that's being INSERTed or UPDATEd
targetRCL
,
boolean
true if this is an UPDATE. false otherwise.
forUpdate
,
ResultSetNode
more information on the tuple stream driving the UPDATE
updateResultSet
)

Parse and bind the generating expressions of computed columns.

public ValueNode

Returns:

The parsed check constraint as a query tree.
parseCheckConstraint
(String
Text of CHECK CONSTRAINT.
checkConstraintText
,
TableDescriptor
The TableDescriptor for the table the the constraint is on.
td
)

Parse a check constraint and turn it into a query tree.

public ValueNode

Returns:

The parsed expression as a query tree.
parseGenerationClause
(String
Text of the generation clause
clauseText
,
TableDescriptor td)

Parse the generation clause for a column.

pack-priv void
printSubNodes(int
The depth of this node in the tree
depth
)

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.printSubNodes.

Prints the sub-nodes of this object.

private int[]
remapReferencedColumns(ConstraintDescriptor
constraint descriptor
cd
,
int[]
1 based row map
rowMap
)

Remap referenced columns in the cd to reflect the passed in row map.

pack-priv boolean

Returns:

true/false
requiresDeferredProcessing
()

Does this DML Node require deferred processing?

pack-priv void
setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan)

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.setRefActionInfo.

set the Information gathered from the parent table that is required to perform a referential action on dependent table.

pack-priv void
pack-priv String
pack-priv void
verifyTargetTable()

Verify the target table.

Inherited from org.apache.derby.impl.sql.compile.DMLStatementNode:
activationKindbindbindExpressionsbindExpressionsWithTablesbindResultSetsWithTablesbindTablesgenerateParameterValueSetgetPrivTypegetResultSetNodemakeResultDescription