|
|||||||||
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.UpdateNode
public final class UpdateNode
An UpdateNode represents an UPDATE statement. It is the top node of the query tree for that statement. For positioned update, there may be no from table specified. The from table will be derived from the cursor specification of the named cursor.
Field Summary | |
---|---|
int[] |
changedColumnIds
|
ValueNode |
checkConstraints
|
static java.lang.String |
COLUMNNAME
|
boolean |
deferred
|
ExecRow |
emptyHeapRow
|
FKInfo |
fkInfo
|
protected boolean |
positionedUpdate
|
protected FormatableBitSet |
readColsBitSet
|
protected FromTable |
targetTable
|
Fields inherited from class org.apache.derby.impl.sql.compile.DMLModStatementNode |
---|
fkColArrays, fkColDescriptors, fkIndexConglomNumbers, fkRefActions, fkTableNames, graphHashTable, 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 |
---|
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 | |
---|---|
UpdateNode()
|
Method Summary | |
---|---|
private static void |
addGeneratedColumnPrecursors(TableDescriptor baseTable,
ColumnDescriptorList affectedGeneratedColumns,
FormatableBitSet columnMap)
Add all of the columns mentioned by the generation clauses of generated columns. |
private void |
addGeneratedColumns(TableDescriptor baseTable,
ResultSetNode updateSet,
ColumnDescriptorList affectedGeneratedColumns,
ColumnDescriptorList addedGeneratedColumns)
Add generated columns to the update list as necessary. |
void |
bindStatement()
Bind this UpdateNode. |
private void |
checkTableNameAndScrubResultColumns(ResultColumnList rcl)
Check table name and then clear it from the result set columns. |
private void |
forbidGenerationOverrides(ResultColumnList targetRCL,
ColumnDescriptorList addedGeneratedColumns)
Do not allow generation clauses to be overriden. |
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Code generation for update. |
private int[] |
getChangedColumnIds(ResultColumnList rcl)
Construct the changedColumnIds array. |
(package private) int |
getPrivType()
Return default privilege needed for this node. |
FormatableBitSet |
getReadMap(DataDictionary dd,
TableDescriptor baseTable,
ResultColumnList updateColumnList,
ColumnDescriptorList affectedGeneratedColumns)
Gets the map of all columns which must be read out of the base table. |
protected int |
getStatementType()
Return the type of statement, something from StatementType. |
static FormatableBitSet |
getUpdateReadMap(TableDescriptor baseTable,
ResultColumnList updateColumnList,
java.util.Vector conglomVector,
ConstraintDescriptorList relevantConstraints,
GenericDescriptorList relevantTriggers,
boolean[] needsDeferredProcessing,
ColumnDescriptorList affectedGeneratedColumns)
Builds a bitmap of all columns which should be read from the Store in order to satisfy an UPDATE statement. |
void |
init(java.lang.Object targetTableName,
java.lang.Object resultSet)
Initializer for an UpdateNode. |
ConstantAction |
makeConstantAction()
Compile constants that Execution will use |
private void |
normalizeCorrelatedColumns(ResultColumnList rcl,
FromTable fromTable)
|
private void |
normalizeSynonymColumns(ResultColumnList rcl,
FromTable fromTable)
Normalize synonym column references to have the name of the base table. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
boolean |
referencesSessionSchema()
Return true if the node references SESSION schema tables (temporary or permanent) |
protected void |
setDeferredForUpdateOfIndexColumn()
Updates are deferred if they update a column in the index used to scan the table being updated. |
java.lang.String |
statementToString()
|
java.lang.String |
toString()
Convert this object to a String. |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int[] changedColumnIds
public ExecRow emptyHeapRow
public boolean deferred
public ValueNode checkConstraints
public FKInfo fkInfo
protected FromTable targetTable
protected FormatableBitSet readColsBitSet
protected boolean positionedUpdate
public static final java.lang.String COLUMNNAME
Constructor Detail |
---|
public UpdateNode()
Method Detail |
---|
public void init(java.lang.Object targetTableName, java.lang.Object resultSet)
init
in class DMLModStatementNode
targetTableName
- The name of the table to updateresultSet
- The ResultSet that will generate
the rows to update from the given tablepublic java.lang.String toString()
toString
in class StatementNode
public java.lang.String statementToString()
statementToString
in class DMLModStatementNode
public void printSubNodes(int depth)
printSubNodes
in class DMLModStatementNode
depth
- The depth of this node in the treepublic void bindStatement() throws StandardException
Binding an update will also massage the tree so that the ResultSetNode has a set of columns to contain the old row value, followed by a set of columns to contain the new row value, followed by a column to contain the RowLocation of the row to be updated.
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 failureprotected void setDeferredForUpdateOfIndexColumn()
public void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- The method for the execute() method to be built
StandardException
- Thrown on errorprotected final int getStatementType()
getStatementType
in class QueryTreeNode
public FormatableBitSet getReadMap(DataDictionary dd, TableDescriptor baseTable, ResultColumnList updateColumnList, ColumnDescriptorList affectedGeneratedColumns) throws StandardException
The returned map is a FormatableBitSet with 1 bit for each column in the table plus an extra, unsued 0-bit. If a 1-based column id must be read from the base table, then the corresponding 1-based bit is turned ON in the returned FormatableBitSet.
NOTE: this method is not expected to be called when all columns are being updated (i.e. updateColumnList is null).
dd
- the data dictionary to look inbaseTable
- the base table descriptorupdateColumnList
- the rcl for the update. CANNOT BE NULLaffectedGeneratedColumns
- columns whose generation clauses mention columns being updated
StandardException
- Thrown on errorprivate int[] getChangedColumnIds(ResultColumnList rcl)
public static FormatableBitSet getUpdateReadMap(TableDescriptor baseTable, ResultColumnList updateColumnList, java.util.Vector conglomVector, ConstraintDescriptorList relevantConstraints, GenericDescriptorList relevantTriggers, boolean[] needsDeferredProcessing, ColumnDescriptorList affectedGeneratedColumns) throws StandardException
updateColumnList
- a list of updated columnsconglomVector
- OUT: vector of affected indicesrelevantConstraints
- IN/OUT. Empty list is passed in. We hang constraints on it as we go.relevantTriggers
- 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 or constraint requires
deferred processingaffectedGeneratedColumns
- columns whose generation clauses mention updated columns
StandardException
- Thrown on errorprivate static void addGeneratedColumnPrecursors(TableDescriptor baseTable, ColumnDescriptorList affectedGeneratedColumns, FormatableBitSet columnMap) throws StandardException
StandardException
private void addGeneratedColumns(TableDescriptor baseTable, ResultSetNode updateSet, ColumnDescriptorList affectedGeneratedColumns, ColumnDescriptorList addedGeneratedColumns) throws StandardException
StandardException
private void normalizeCorrelatedColumns(ResultColumnList rcl, FromTable fromTable) throws StandardException
StandardException
private void checkTableNameAndScrubResultColumns(ResultColumnList rcl) throws StandardException
StandardExcepion
- if invalid column/table is specified.
StandardException
private void normalizeSynonymColumns(ResultColumnList rcl, FromTable fromTable) throws StandardException
rcl
- The result column list of the target tablefromTable
- The table name to set the column refs to
StandardException
- Thrown on errorprivate void forbidGenerationOverrides(ResultColumnList targetRCL, ColumnDescriptorList addedGeneratedColumns) throws StandardException
targetRCL
- the row in the table being UPDATEdaddedGeneratedColumns
- generated columns which the compiler added
earlier on
StandardException
- on error
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |