|
|||||||||
| 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
org.apache.derby.impl.sql.compile.DeleteNode
public class DeleteNode
A DeleteNode represents a DELETE statement. It is the top-level node for the statement. For positioned delete, there may be no from table specified. The from table will be derived from the cursor specification of the named cursor.
| Field Summary | |
|---|---|
private boolean |
cascadeDelete
|
private static java.lang.String |
COLUMNNAME
|
protected boolean |
deferred
|
private ConstantAction[] |
dependentConstantActions
|
private StatementNode[] |
dependentNodes
|
protected FKInfo |
fkInfo
|
protected FormatableBitSet |
readColsBitSet
|
protected FromTable |
targetTable
|
| Fields inherited from class org.apache.derby.impl.sql.compile.DMLModStatementNode |
|---|
dependentTables, fkColArrays, fkColDescriptors, fkIndexConglomNumbers, fkRefActions, fkTableNames, indexConglomerateNumbers, indexNames, indicesToMaintain, isDependentTable, lockMode, relevantCdl, relevantTriggers, resultColumnList, synonymTableName, targetTableDescriptor, targetTableName, targetVTI, triggerInfo |
| Fields inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode |
|---|
resultSet |
| Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode |
|---|
EMPTY_TD_LIST, 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_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
| Constructor Summary | |
|---|---|
DeleteNode()
|
|
| Method Summary | |
|---|---|
void |
bindStatement()
Bind this DeleteNode. |
private void |
correlateAddedColumns(ResultColumnList rcl,
FromTable fromTable)
|
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Code generation for delete. |
private static FormatableBitSet |
getDeleteReadMap(TableDescriptor baseTable,
java.util.List conglomVector,
GenericDescriptorList 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(TableName tabName,
ColumnDescriptorList cdl)
|
protected int |
getStatementType()
Return the type of statement, something from StatementType. |
void |
init(java.lang.Object targetTableName,
java.lang.Object queryExpression)
Initializer for a DeleteNode. |
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) |
java.lang.String |
statementToString()
|
| Methods inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode |
|---|
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getResultSetNode, makeResultDescription |
| Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode |
|---|
executeSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilation, needsSavepoint, toString, updateIndexStatisticsFor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String COLUMNNAME
protected boolean deferred
protected FromTable targetTable
protected FKInfo fkInfo
protected FormatableBitSet readColsBitSet
private ConstantAction[] dependentConstantActions
private boolean cascadeDelete
private StatementNode[] dependentNodes
| Constructor Detail |
|---|
public DeleteNode()
| Method Detail |
|---|
public void init(java.lang.Object targetTableName,
java.lang.Object queryExpression)
init in interface Nodeinit in class DMLModStatementNodetargetTableName - The name of the table to delete fromqueryExpression - The query expression that will generate
the rows to delete from the given tablepublic java.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 StatementNodeStandardException - Thrown on errorint getPrivType()
DMLStatementNode
getPrivType in class DMLStatementNode
public boolean referencesSessionSchema()
throws StandardException
referencesSessionSchema in class QueryTreeNodeStandardException - Thrown on error
public ConstantAction makeConstantAction()
throws StandardException
makeConstantAction in class QueryTreeNodeStandardException - Thrown on failure
public void generate(ActivationClassBuilder acb,
MethodBuilder mb)
throws StandardException
generate in class QueryTreeNodeacb - The ActivationClassBuilder for the class being builtmb - The execute() method to be built
StandardException - 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 descriptor
StandardException - Thrown on error
private 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(TableName tabName,
ColumnDescriptorList cdl)
throws StandardException
StandardException
public void optimizeStatement()
throws StandardException
DMLModStatementNode
optimizeStatement in class DMLModStatementNodeStandardException - Thrown on failure
private static FormatableBitSet getDeleteReadMap(TableDescriptor baseTable,
java.util.List conglomVector,
GenericDescriptorList relevantTriggers,
boolean[] needsDeferredProcessing)
throws StandardException
conglomVector - OUT: vector 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 processing
StandardException - Thrown on error
private void correlateAddedColumns(ResultColumnList rcl,
FromTable fromTable)
throws StandardException
StandardException
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||