|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.StatementNode
org.apache.derby.impl.sql.compile.DMLStatementNode
org.apache.derby.impl.sql.compile.DMLModStatementNode
A DMLStatement for a table modification: to wit, INSERT UPDATE or DELETE.
Field Summary | |
private boolean |
bound
|
private ValueNode |
checkConstraints
|
protected int[][] |
fkColArrays
|
protected ColumnDescriptorList[] |
fkColDescriptors
|
protected long[] |
fkIndexConglomNumbers
|
protected FKInfo[] |
fkInfo
|
protected int[] |
fkRefActions
|
protected java.lang.String[] |
fkTableNames
|
protected java.util.Hashtable |
graphHashTable
|
long[] |
indexConglomerateNumbers
|
java.lang.String[] |
indexNames
|
IndexRowGenerator[] |
indicesToMaintain
|
protected boolean |
isDependentTable
|
protected int |
lockMode
|
protected ConstraintDescriptorList |
relevantCdl
|
protected GenericDescriptorList |
relevantTriggers
|
private boolean |
requiresDeferredProcessing
|
protected ResultColumnList |
resultColumnList
|
private int |
statementType
|
TableDescriptor |
targetTableDescriptor
|
protected TableName |
targetTableName
|
protected FromVTI |
targetVTI
|
protected TriggerInfo |
triggerInfo
|
Fields inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode |
resultSet |
Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode |
NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATION |
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
Constructor Summary | |
DMLModStatementNode()
|
Method Summary | |
protected void |
adjustDeferredFlag(boolean adjustment)
|
void |
bindCheckConstraint(NodeFactory nodeFactory,
TableDescriptor targetTableDescriptor,
ResultColumnList sourceRCL,
ValueNode checkConstraint)
Binds an already parsed check constraint |
ValueNode |
bindConstraints(DataDictionary dataDictionary,
NodeFactory nodeFactory,
TableDescriptor targetTableDescriptor,
Dependent dependent,
ResultColumnList sourceRCL,
int[] changedColumnIds,
FormatableBitSet readColsBitSet,
boolean skipCheckConstraints,
boolean includeTriggers)
Gets and binds all the constraints for an INSERT/UPDATE/DELETE. |
private void |
createConstraintDependencies(DataDictionary dd,
ConstraintDescriptorList cdl,
Dependent dependent)
Get all of our dependents due to a constraint. |
private void |
createTriggerDependencies(GenericDescriptorList 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)
|
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)
Get the ANDing of all appropriate check constraints as 1 giant query tree. |
protected void |
generateCodeForTemporaryTable(ActivationClassBuilder acb,
MethodBuilder mb)
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 void |
generateTriggerInfo(GenericDescriptorList triggerList,
TableDescriptor td,
int[] changedCols)
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,
boolean skipCheckConstraints,
int[] changedColumnIds)
Get all the constraints relevant to this DML operation |
protected GenericDescriptorList |
getAllRelevantTriggers(DataDictionary dd,
TableDescriptor td,
int[] changedColumnIds,
boolean includeTriggers)
Get all the triggers relevant to this DML operation |
ValueNode |
getCheckConstraints()
Get the check constraints for this node |
FKInfo[] |
getFKInfo()
Return the FKInfo structure. |
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. |
SchemaDescriptor |
getSchemaDescriptor()
Get a schema descriptor for the given table. |
TriggerInfo |
getTriggerInfo()
Return the TriggerInfo structure. |
(package private) static void |
getXAffectedIndexes(TableDescriptor baseTable,
ResultColumnList updatedColumns,
FormatableBitSet colBitSet,
java.util.Vector conglomVector)
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. |
void |
init(java.lang.Object resultSet)
Initializer for a DMLModStatementNode -- delegate to DMLStatementNode |
void |
init(java.lang.Object resultSet,
java.lang.Object statementType)
Initializer for a DMLModStatementNode -- delegate to DMLStatementNode |
boolean |
isAtomic()
INSERT/UPDATE/DELETE are always atomic. |
protected void |
markAffectedIndexes(java.util.Vector affectedConglomerates)
|
QueryTreeNode |
optimize()
Generate an optimized QueryTree from a bound QueryTree. |
ValueNode |
parseCheckConstraint(java.lang.String checkConstraintText,
TableDescriptor td)
Parse a check constraint and turn it into a query tree. |
private int[] |
remapReferencedColumns(ConstraintDescriptor cd,
int[] rowMap)
Remap referenced columns in the cd to reflect the passed in row map. |
boolean |
requiresDeferredProcessing()
Does this DML Node require deferred processing? |
void |
setRefActionInfo(long fkIndexConglomId,
int[] fkColArray,
java.lang.String parentResultSetId,
boolean dependentScan)
set the Information gathered from the parent table that is required to peform a referential action on dependent table. |
(package private) void |
setTarget(QueryTreeNode targetName)
|
java.lang.String |
statementToString()
|
(package private) void |
verifyTargetTable()
Verify the target table. |
Methods inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode |
accept, activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterHolders, generateParameterValueSet, getResultSetNode, makeResultDescription, printSubNodes |
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode |
generate, lockTableForCompilation, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected FromVTI targetVTI
protected TableName targetTableName
protected ResultColumnList resultColumnList
protected int lockMode
protected FKInfo[] fkInfo
protected TriggerInfo triggerInfo
public TableDescriptor targetTableDescriptor
public IndexRowGenerator[] indicesToMaintain
public long[] indexConglomerateNumbers
public java.lang.String[] indexNames
protected ConstraintDescriptorList relevantCdl
protected GenericDescriptorList relevantTriggers
private boolean requiresDeferredProcessing
private int statementType
private boolean bound
private ValueNode checkConstraints
protected java.lang.String[] fkTableNames
protected int[] fkRefActions
protected ColumnDescriptorList[] fkColDescriptors
protected long[] fkIndexConglomNumbers
protected boolean isDependentTable
protected int[][] fkColArrays
protected java.util.Hashtable graphHashTable
Constructor Detail |
public DMLModStatementNode()
Method Detail |
public void init(java.lang.Object resultSet)
init
in class DMLStatementNode
resultSet
- A ResultSetNode for the result set of the
DML statementpublic void init(java.lang.Object resultSet, java.lang.Object statementType)
init
in class QueryTreeNode
resultSet
- A ResultSetNode for the result set of the
DML statementstatementType
- used by nodes that allocate a DMLMod directly
(rather than inheriting it).void setTarget(QueryTreeNode targetName)
protected void generateCodeForTemporaryTable(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
acb
- The ActivationClassBuilder for the class being builtmb
- The execute() method to be built
StandardException
- Thrown on errorvoid verifyTargetTable() throws StandardException
StandardException
- Thrown on errorpublic boolean isAtomic()
isAtomic
in class DMLStatementNode
public SchemaDescriptor getSchemaDescriptor() throws StandardException
StandardException
- throws on schema name
that doesn't existpublic static 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 errorpublic ValueNode bindConstraints(DataDictionary dataDictionary, NodeFactory nodeFactory, TableDescriptor targetTableDescriptor, Dependent dependent, ResultColumnList sourceRCL, int[] changedColumnIds, FormatableBitSet readColsBitSet, boolean skipCheckConstraints, boolean includeTriggers) throws StandardException
dataDictionary
- The DataDictionarynodeFactory
- Where to get query tree nodes.targetTableDescriptor
- 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 scanskipCheckConstraints
- whether to skip check constraints or notincludeTriggers
- whether triggers are included in the processing
StandardException
- Thrown on failurepublic void bindCheckConstraint(NodeFactory nodeFactory, TableDescriptor targetTableDescriptor, ResultColumnList sourceRCL, ValueNode checkConstraint) throws StandardException
nodeFactory
- Where to get query tree nodes.targetTableDescriptor
- The TableDescriptor for the constrained table.checkConstraint
- Parsed query tree for check constraint
StandardException
- Thrown on failureprotected boolean hasCheckConstraints(DataDictionary dd, TableDescriptor td) throws StandardException
dd
- The DataDictionary to usetd
- The TableDescriptor for the table
StandardException
- Thrown on failureprivate ValueNode generateCheckTree(ConstraintDescriptorList cdl, TableDescriptor td) throws StandardException
cdl
- The constriant descriptor listtd
- The TableDescriptor
StandardException
- Thrown on failureprivate void generateFKInfo(ConstraintDescriptorList cdl, DataDictionary dd, TableDescriptor td, FormatableBitSet readColsBitSet) throws StandardException
cdl
- The constriant descriptor listdd
- The DataDictionarytd
- The TableDescriptorreadColsBitSet
- columns read
StandardException
- Thrown on failureprivate void fkSetupArrays(DataDictionary dd, ForeignKeyConstraintDescriptor fkcd, int index, UUID[] uuids, long[] conglomNumbers, java.lang.String[] fkNames, boolean[] isSelfReferencingFK, int[] raRules) throws StandardException
StandardException
private void generateTriggerInfo(GenericDescriptorList triggerList, TableDescriptor td, int[] changedCols) throws StandardException
td
- The TableDescriptorchangedCols
- The columns that are being modified
StandardException
- Thrown on failurepublic FKInfo[] getFKInfo()
public TriggerInfo getTriggerInfo()
public ValueNode getCheckConstraints()
private void createTriggerDependencies(GenericDescriptorList 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 GenericDescriptorList 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 table
StandardException
- 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, boolean skipCheckConstraints, int[] changedColumnIds) throws StandardException
dd
- The DataDictionarytd
- The TableDescriptorskipCheckConstraints
- Skip check constraintschangedColumnIds
- If null, all columns being changed, otherwise array
of 1-based column ids for columns being changed
StandardException
- Thrown on failurepublic boolean 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 Builder
StandardException
- Thrown on errorpublic MethodBuilder generateCheckConstraints(ValueNode checkConstraints, ExpressionClassBuilder ecb) throws StandardException
checkConstraints
- Bound query tree of ANDed check constraints.ecb
- Expression Class Builder
StandardException
- Thrown on errorpublic QueryTreeNode optimize() throws StandardException
optimize
in class DMLStatementNode
StandardException
- 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 list
StandardException
- Thrown on errorstatic void getXAffectedIndexes(TableDescriptor baseTable, ResultColumnList updatedColumns, FormatableBitSet colBitSet, java.util.Vector conglomVector) throws StandardException
updatedColumns
- a list of updated columnscolBitSet
- OUT: evolving bitmap of affected columnsconglomVector
- OUT: vector of affected indices
StandardException
- Thrown on errorprotected void markAffectedIndexes(java.util.Vector affectedConglomerates) throws StandardException
StandardException
public java.lang.String statementToString()
statementToString
in class StatementNode
private int[] remapReferencedColumns(ConstraintDescriptor cd, int[] rowMap)
cd
- constraint descriptorrowMap
- 1 based row mapprivate int[] getRowMap(FormatableBitSet bitSet, TableDescriptor td) throws StandardException
bitSet
- td
-
StandardException
public void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, java.lang.String parentResultSetId, boolean dependentScan)
QueryTreeNode
setRefActionInfo
in class QueryTreeNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |