| java.lang.Object org.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
UpdateNode | final public class UpdateNode extends DMLModStatementNode (Code) | | 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.
author: Jeff Lichtman |
Method Summary | |
public QueryTreeNode | bind() Bind this UpdateNode. | public void | generate(ActivationClassBuilder acb, MethodBuilder mb) Code generation for update.
The generated code will contain:
o A static member for the (xxx)ResultSet with the RowLocations and
new update values
o The static member will be assigned the appropriate ResultSet within
the nested calls to get the ResultSets. | int | getPrivType() | public FormatableBitSet | getReadMap(DataDictionary dd, TableDescriptor baseTable, ResultColumnList updateColumnList) Gets the map of all columns which must be read out of the base table.
These are the columns needed to:
- maintain indices
- maintain foreign keys
- support Replication's Delta Optimization
The returned map is a FormatableBitSet with 1 bit for each column in the
table plus an extra, unsued 0-bit. | final protected int | getStatementType() Return the type of statement, something from
StatementType. | public static FormatableBitSet | getUpdateReadMap(TableDescriptor baseTable, ResultColumnList updateColumnList, Vector conglomVector, ConstraintDescriptorList relevantConstraints, GenericDescriptorList relevantTriggers, boolean[] needsDeferredProcessing) Builds a bitmap of all columns which should be read from the
Store in order to satisfy an UPDATE statement.
Is passed a list of updated columns. | public void | init(Object targetTableName, Object resultSet) Initializer for an UpdateNode. | public ConstantAction | makeConstantAction() | public void | printSubNodes(int depth) Prints the sub-nodes of this object. | public boolean | referencesSessionSchema() | protected void | setDeferredForUpdateOfIndexColumn() Updates are deferred if they update a column in the index
used to scan the table being updated. | public String | statementToString() | public String | toString() Convert this object to a String. |
changedColumnIds | public int[] changedColumnIds(Code) | | |
deferred | public boolean deferred(Code) | | |
positionedUpdate | protected boolean positionedUpdate(Code) | | |
bind | public QueryTreeNode bind() throws StandardException(Code) | | Bind this UpdateNode. This means looking up tables and columns and
getting their types, and figuring out the result types of all
expressions, as well as doing view resolution, permissions checking,
etc.
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.
The bound query tree exception: StandardException - Thrown on error |
generate | public void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException(Code) | | Code generation for update.
The generated code will contain:
o A static member for the (xxx)ResultSet with the RowLocations and
new update values
o The static member will be assigned the appropriate ResultSet within
the nested calls to get the ResultSets. (The appropriate cast to the
(xxx)ResultSet will be generated.)
o The CurrentRowLocation() in SelectNode's select list will generate
a new method for returning the RowLocation as well as a call to
that method when generating the (xxx)ResultSet.
Parameters: acb - The ActivationClassBuilder for the class being built Parameters: mb - The method for the execute() method to be built exception: StandardException - Thrown on error |
getPrivType | int getPrivType()(Code) | | |
getReadMap | public FormatableBitSet getReadMap(DataDictionary dd, TableDescriptor baseTable, ResultColumnList updateColumnList) throws StandardException(Code) | | Gets the map of all columns which must be read out of the base table.
These are the columns needed to:
- maintain indices
- maintain foreign keys
- support Replication's Delta Optimization
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).
Parameters: dd - the data dictionary to look in Parameters: baseTable - the base table descriptor Parameters: updateColumnList - the rcl for the update. CANNOT BE NULL a FormatableBitSet of columns to be read out of the base table exception: StandardException - Thrown on error |
getStatementType | final protected int getStatementType()(Code) | | Return the type of statement, something from
StatementType.
the type of statement |
getUpdateReadMap | public static FormatableBitSet getUpdateReadMap(TableDescriptor baseTable, ResultColumnList updateColumnList, Vector conglomVector, ConstraintDescriptorList relevantConstraints, GenericDescriptorList relevantTriggers, boolean[] needsDeferredProcessing) throws StandardException(Code) | | Builds a bitmap of all columns which should be read from the
Store in order to satisfy an UPDATE statement.
Is passed a list of updated columns. Does the following:
1) finds all indices which overlap the updated columns
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 constraints which overlap the updated columns
and adds the constrained columns to the bitmap
5) finds all triggers which overlap the updated columns.
6) if there are any triggers, marks all columns in the bitmap
7) adds the triggers to an evolving list of triggers
Parameters: updateColumnList - a list of updated columns Parameters: conglomVector - OUT: vector of affected indices Parameters: relevantConstraints - IN/OUT. Empty list is passed in. We hang constraints on it as we go. Parameters: relevantTriggers - IN/OUT. Passed in as an empty list. Filled in as we go. Parameters: needsDeferredProcessing - IN/OUT. true if the statement already needsdeferred processing. set while evaluating thisroutine if a trigger or constraint requiresdeferred processing a FormatableBitSet of columns to be read out of the base table exception: StandardException - Thrown on error |
init | public void init(Object targetTableName, Object resultSet)(Code) | | Initializer for an UpdateNode.
Parameters: targetTableName - The name of the table to update Parameters: resultSet - The ResultSet that will generatethe rows to update from the given table |
printSubNodes | public void printSubNodes(int depth)(Code) | | Prints the sub-nodes of this object. See QueryTreeNode.java for
how tree printing is supposed to work.
Parameters: depth - The depth of this node in the tree |
referencesSessionSchema | public boolean referencesSessionSchema() throws StandardException(Code) | | Return true if the node references SESSION schema tables (temporary or permanent)
true if references SESSION schema tables, else false exception: StandardException - Thrown on error |
setDeferredForUpdateOfIndexColumn | protected void setDeferredForUpdateOfIndexColumn()(Code) | | Updates are deferred if they update a column in the index
used to scan the table being updated.
|
toString | public String toString()(Code) | | Convert this object to a String. See comments in QueryTreeNode.java
for how this should be done for tree printing.
This object as a String |
Methods inherited from org.apache.derby.impl.sql.compile.DMLModStatementNode | protected void adjustDeferredFlag(boolean adjustment)(Code)(Java Doc) public void bindCheckConstraint(NodeFactory nodeFactory, TableDescriptor targetTableDescriptor, ResultColumnList sourceRCL, ValueNode checkConstraint) throws StandardException(Code)(Java Doc) public ValueNode bindConstraints(DataDictionary dataDictionary, NodeFactory nodeFactory, TableDescriptor targetTableDescriptor, Dependent dependent, ResultColumnList sourceRCL, int[] changedColumnIds, FormatableBitSet readColsBitSet, boolean skipCheckConstraints, boolean includeTriggers) throws StandardException(Code)(Java Doc) public void generateCheckConstraints(ValueNode checkConstraints, ExpressionClassBuilder ecb, MethodBuilder mb) throws StandardException(Code)(Java Doc) public MethodBuilder generateCheckConstraints(ValueNode checkConstraints, ExpressionClassBuilder ecb) throws StandardException(Code)(Java Doc) protected void generateCodeForTemporaryTable(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException(Code)(Java Doc) protected void getAffectedIndexes(TableDescriptor td, ResultColumnList updatedColumns, FormatableBitSet colBitSet) throws StandardException(Code)(Java Doc) protected ConstraintDescriptorList getAllRelevantConstraints(DataDictionary dd, TableDescriptor td, boolean skipCheckConstraints, int[] changedColumnIds) throws StandardException(Code)(Java Doc) protected GenericDescriptorList getAllRelevantTriggers(DataDictionary dd, TableDescriptor td, int[] changedColumnIds, boolean includeTriggers) throws StandardException(Code)(Java Doc) public ValueNode getCheckConstraints()(Code)(Java Doc) public FKInfo[] getFKInfo()(Code)(Java Doc) public static int[] getReadColMap(int column_map_length, FormatableBitSet readColsBitSet)(Code)(Java Doc) protected void getResultColumnList() throws StandardException(Code)(Java Doc) protected FromBaseTable getResultColumnList(ResultColumnList inputRcl) throws StandardException(Code)(Java Doc) public SchemaDescriptor getSchemaDescriptor() throws StandardException(Code)(Java Doc) public TriggerInfo getTriggerInfo()(Code)(Java Doc) static void getXAffectedIndexes(TableDescriptor baseTable, ResultColumnList updatedColumns, FormatableBitSet colBitSet, Vector conglomVector) throws StandardException(Code)(Java Doc) protected boolean hasCheckConstraints(DataDictionary dd, TableDescriptor td) throws StandardException(Code)(Java Doc) public void init(Object resultSet)(Code)(Java Doc) public void init(Object resultSet, Object statementType)(Code)(Java Doc) public boolean isAtomic()(Code)(Java Doc) protected void markAffectedIndexes(Vector affectedConglomerates) throws StandardException(Code)(Java Doc) public void normalizeSynonymColumns(ResultColumnList rcl, TableName targetTableName) throws StandardException(Code)(Java Doc) public QueryTreeNode optimize() throws StandardException(Code)(Java Doc) public ValueNode parseCheckConstraint(String checkConstraintText, TableDescriptor td) throws StandardException(Code)(Java Doc) public boolean requiresDeferredProcessing()(Code)(Java Doc) public void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan)(Code)(Java Doc) void setTarget(QueryTreeNode targetName)(Code)(Java Doc) public String statementToString()(Code)(Java Doc) void verifyTargetTable() throws StandardException(Code)(Java Doc)
|
Methods inherited from org.apache.derby.impl.sql.compile.QueryTreeNode | public Visitable accept(Visitor v) throws StandardException(Code)(Java Doc) public QueryTreeNode bind() throws StandardException(Code)(Java Doc) public DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor) throws StandardException(Code)(Java Doc) protected static void debugFlush()(Code)(Java Doc) public static void debugPrint(String outputString)(Code)(Java Doc) public void disablePrivilegeCollection()(Code)(Java Doc) public String executeSchemaName()(Code)(Java Doc) public String executeStatementName()(Code)(Java Doc) public static String formatNodeString(String nodeString, int depth)(Code)(Java Doc) public boolean foundString(String[] list, String search)(Code)(Java Doc) public GeneratedClass generate(ByteArray ignored) throws StandardException(Code)(Java Doc) protected void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException(Code)(Java Doc) void generateAuthorizeCheck(ActivationClassBuilder acb, MethodBuilder mb, int sqlOperation)(Code)(Java Doc) public int getBeginOffset()(Code)(Java Doc) final protected ClassFactory getClassFactory()(Code)(Java Doc) final protected CompilerContext getCompilerContext()(Code)(Java Doc) final public ContextManager getContextManager()(Code)(Java Doc) public Object getCursorInfo() throws StandardException(Code)(Java Doc) final public DataDictionary getDataDictionary()(Code)(Java Doc) final public DependencyManager getDependencyManager()(Code)(Java Doc) public int getEndOffset()(Code)(Java Doc) final public ExecutionFactory getExecutionFactory()(Code)(Java Doc) final public GenericConstantActionFactory getGenericConstantActionFactory()(Code)(Java Doc) protected int getIntProperty(String value, String key) throws StandardException(Code)(Java Doc) final protected LanguageConnectionContext getLanguageConnectionContext()(Code)(Java Doc) final public NodeFactory getNodeFactory()(Code)(Java Doc) protected int getNodeType()(Code)(Java Doc) public ConstantNode getNullNode(TypeId typeId, ContextManager cm) throws StandardException(Code)(Java Doc) public DataTypeDescriptor[] getParameterTypes() throws StandardException(Code)(Java Doc) public long getRowEstimate()(Code)(Java Doc) public String getSPSName()(Code)(Java Doc) final SchemaDescriptor getSchemaDescriptor(String schemaName) throws StandardException(Code)(Java Doc) final SchemaDescriptor getSchemaDescriptor(String schemaName, boolean raiseError) throws StandardException(Code)(Java Doc) protected int getStatementType()(Code)(Java Doc) final protected TableDescriptor getTableDescriptor(String tableName, SchemaDescriptor schema) throws StandardException(Code)(Java Doc) final protected TypeCompiler getTypeCompiler(TypeId typeId)(Code)(Java Doc) public void init(Object arg1) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14) throws StandardException(Code)(Java Doc) public boolean isAtomic() throws StandardException(Code)(Java Doc) protected boolean isInstanceOf(int nodeType)(Code)(Java Doc) public boolean isPrivilegeCollectionRequired()(Code)(Java Doc) final boolean isSessionSchema(SchemaDescriptor sd)(Code)(Java Doc) final boolean isSessionSchema(String schemaName)(Code)(Java Doc) public ConstantAction makeConstantAction() throws StandardException(Code)(Java Doc) public ResultDescription makeResultDescription() throws StandardException(Code)(Java Doc) public TableName makeTableName(String schemaName, String flatName) throws StandardException(Code)(Java Doc) public boolean needsSavepoint()(Code)(Java Doc) protected String nodeHeader()(Code)(Java Doc) public QueryTreeNode optimize() throws StandardException(Code)(Java Doc) public static QueryTreeNode parseQueryText(CompilerContext compilerContext, String queryText, Object[] paramDefaults, LanguageConnectionContext lcc) throws StandardException(Code)(Java Doc) public void printLabel(int depth, String label)(Code)(Java Doc) public void printSubNodes(int depth)(Code)(Java Doc) public boolean referencesSessionSchema() throws StandardException(Code)(Java Doc) public TableName resolveTableToSynonym(TableName tabName) throws StandardException(Code)(Java Doc) public void setBeginOffset(int beginOffset)(Code)(Java Doc) public void setContextManager(ContextManager cm)(Code)(Java Doc) public void setEndOffset(int endOffset)(Code)(Java Doc) public void setNodeType(int nodeType)(Code)(Java Doc) public void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan)(Code)(Java Doc) public String toString()(Code)(Java Doc) public void treePrint()(Code)(Java Doc) public void treePrint(int depth)(Code)(Java Doc) String verifyClassExist(String javaClassName, boolean convertCase) throws StandardException(Code)(Java Doc)
|
|
|