| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private int | |
| private DMLModStatementNode | |
| private ResultColumnList | |
| private ResultColumnList | |
| private ValueNode | |
| private String | |
| private String | |
| private ResultColumnList | |
| private ResultColumnList | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private | MatchingClauseNode(ValueNode matchingRefinement, ResultColumnList updateColumns, ResultColumnList insertColumns, ResultColumnList insertValues, ContextManager cm)
Constructor called by factory methods. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | acceptChildren(Visitor
the visitor v)Overrides org. Accept the visitor for all visitable children of this node. |
| private void | adjustMatchingRefinement(ResultColumnList selectList, ResultSetNode generatedScan)
Point the column references in the matching refinement at the corresponding columns returned by the driving left join. |
| private void | adjustThenColumns(ResultColumnList selectList, ResultSetNode generatedScan, HalfOuterJoinNode hojn)
Point the column references in the temporary row at the corresponding columns returned by the driving left join. |
| private boolean | autoincrementColumnSetToDEFAULT(TableDescriptor
Target table catalog info targetTableDescriptor, ResultColumnList Columns explicitly mentioned in the VALUES clause valuesList)Return true if the VALUES clause of the INSERT branch contains an autoincrement column which is set to DEFAULT or if the VALUES clause doesn't explicitly mention the autoincrement column. |
| pack-priv void | bind(DataDictionary dd, MergeNode mergeNode, FromList fullFromList, FromBaseTable targetTable)
Bind this WHEN [ NOT ] MATCHED clause against the parent MergeNode |
| private void | bindDelete(DataDictionary dd, FromList fullFromList, FromBaseTable targetTable)
Bind a WHEN MATCHED ... |
| private void | bindExpressions(ResultColumnList rcl, FromList fromList)
Boilerplate for binding a list of ResultColumns against a FromList |
| private void | bindInsert(DataDictionary dd, MergeNode mergeNode, FromList fullFromList, FromBaseTable targetTable)
Bind a WHEN NOT MATCHED ... |
| private void | |
| pack-priv void | bindRefinement(MergeNode mergeNode, FromList fullFromList)
Bind the optional refinement condition in the MATCHED clause |
| private void | bindSetClauses(MergeNode mergeNode, FromList fullFromList, FromTable targetTable, ResultColumnList setClauses)
Bind the SET clauses of an UPDATE action |
| private void | bindUpdate(DataDictionary dd, MergeNode mergeNode, FromList fullFromList, FromBaseTable targetTable)
Bind a WHEN MATCHED ... |
| private ResultColumnList | |
| private void | buildThenColumnsForDelete()
Construct the signature of the temporary table which drives the INSERT/UPDATE/DELETE action. |
| private void | buildThenColumnsForInsert(FromList fullFromList, FromTable targetTable, ResultColumnList fullRow, ResultColumnList insertColumns, ResultColumnList insertValues)
Construct the row in the temporary table which drives an INSERT action. |
| private void | buildThenColumnsForUpdate(FromList fullFromList, FromTable targetTable, ResultColumnList fullRow, ResultColumnList beforeRow, ResultColumnList afterValues)
Construct the row in the temporary table which drives an UPDATE action. |
| private ResultDescription | |
| private void | |
| private void | |
| private void | |
| pack-priv void | generate(ActivationClassBuilder acb, ResultColumnList selectList, ResultSetNode generatedScan, HalfOuterJoinNode hojn, int clauseNumber)
Generate a method to invoke the INSERT/UPDATE/DELETE action. |
| private void | generateInsertUpdateRow(ActivationClassBuilder acb, ResultColumnList selectList, ResultSetNode generatedScan, HalfOuterJoinNode hojn)
Generate a method to build a row for the temporary table for INSERT/UPDATE actions. |
| pack-priv void | generateResultSetField(ActivationClassBuilder acb, MethodBuilder mb)
Adds a field to the generated class to hold the ResultSet of "then" rows which drive the INSERT/UPDATE/DELETE action. |
| private ResultSetNode | |
| private HashSet | |
| private HashSet | getChangedGeneratedColumnNames(TableDescriptor targetTableDescriptor, HashSet<String> changedColumnNames)
Get the names of the generated columns which are changed by the UPDATE statement. |
| private int | |
| private List | |
| pack-priv void | getColumnsInExpressions(MergeNode mergeNode, HashMap<String, ColumnReference> drivingColumnMap)
Collect the columns mentioned by expressions in this MATCHED clause |
| private int | |
| private int | getSelectListOffset(ResultColumnList selectList, ValueNode thenExpression)
Find a column reference in the SELECT list of the driving left join and return its 1-based offset into that list. |
| pack-priv ResultColumnList | getThenColumns()
Return the list of columns which form the rows of the ResultSet which drive the INSERT/UPDATE/DELETE actions. |
| pack-priv boolean | |
| pack-priv boolean | |
| private boolean | |
| pack-priv boolean | |
| private ResultColumn | makeAutoGenRC(FromTable targetTable, ResultColumn origRC, int virtualColumnID)
Make a ResultColumn for an identity column which is being set to the DEFAULT value. |
| pack-priv ConstantAction | |
| pack-priv static MatchingClauseNode | |
| pack-priv static MatchingClauseNode | makeInsertClause(ValueNode matchingRefinement, ResultColumnList insertColumns, ResultColumnList insertValues, ContextManager cm)
Make a WHEN NOT MATCHED ... |
| pack-priv static MatchingClauseNode | makeUpdateClause(ValueNode matchingRefinement, ResultColumnList updateColumns, ContextManager cm)
Make a WHEN MATCHED ... |
| pack-priv void | |
| pack-priv void | printSubNodes(int
The depth of this node in the tree depth)Overrides org. Prints the sub-nodes of this object. |
| private ResultColumnList | realiasSetClauses(FromBaseTable targetTable)
Due to discrepancies in how names are resolved by SELECT and UPDATE, we have to force the left side of SET clauses to use the same table identifiers as the right sides of the SET clauses. |
| public boolean | referencesSessionSchema()
Overrides org. Return true if the node references SESSION schema tables (temporary or permanent) |
| private static boolean | |
| private void | remapConstraints()
Re-map ColumnReferences in constraints to point into the row from the temporary table. |
| public String | Returns: This object as a StringOverrides org. Convert this object to a String. |
| private void | useGeneratedScan(ResultColumnList selectList, ResultSetNode generatedScan, QueryTreeNode node)
Point a node's ColumnReferences into the row returned by the driving left join. |
| _actionMethodName | back to summary |
|---|---|
| private String _actionMethodName | |
| _clauseNumber | back to summary |
|---|---|
| private int _clauseNumber | |
| _dml | back to summary |
|---|---|
| private DMLModStatementNode _dml | |
| _insertColumns | back to summary |
|---|---|
| private ResultColumnList _insertColumns | |
| _insertValues | back to summary |
|---|---|
| private ResultColumnList _insertValues | |
| _matchingRefinement | back to summary |
|---|---|
| private ValueNode _matchingRefinement | |
| _resultSetFieldName | back to summary |
|---|---|
| private String _resultSetFieldName | |
| _rowMakingMethodName | back to summary |
|---|---|
| private String _rowMakingMethodName | |
| _thenColumns | back to summary |
|---|---|
| private ResultColumnList _thenColumns | |
| _updateColumns | back to summary |
|---|---|
| private ResultColumnList _updateColumns | |
| CURRENT_OF_NODE_NAME | back to summary |
|---|---|
| private static final String CURRENT_OF_NODE_NAME | |
| MatchingClauseNode | back to summary |
|---|---|
| private MatchingClauseNode(ValueNode matchingRefinement, ResultColumnList updateColumns, ResultColumnList insertColumns, ResultColumnList insertValues, ContextManager cm) throws StandardException Constructor called by factory methods. | |
| acceptChildren | back to summary |
|---|---|
| pack-priv void acceptChildren(Visitor v) throws StandardException Overrides org. Accept the visitor for all visitable children of this node.
| |
| adjustMatchingRefinement | back to summary |
|---|---|
| private void adjustMatchingRefinement(ResultColumnList selectList, ResultSetNode generatedScan) throws StandardException Point the column references in the matching refinement at the corresponding columns returned by the driving left join. | |
| adjustThenColumns | back to summary |
|---|---|
| private void adjustThenColumns(ResultColumnList selectList, ResultSetNode generatedScan, HalfOuterJoinNode hojn) throws StandardException Point the column references in the temporary row at the corresponding columns returned by the driving left join. | |
| autoincrementColumnSetToDEFAULT | back to summary |
|---|---|
| private boolean autoincrementColumnSetToDEFAULT(TableDescriptor targetTableDescriptor, ResultColumnList valuesList) Return true if the VALUES clause of the INSERT branch contains an autoincrement column which is set to DEFAULT or if the VALUES clause doesn't explicitly mention the autoincrement column.
| |
| bind | back to summary |
|---|---|
| pack-priv void bind(DataDictionary dd, MergeNode mergeNode, FromList fullFromList, FromBaseTable targetTable) throws StandardException Bind this WHEN [ NOT ] MATCHED clause against the parent MergeNode | |
| bindDelete | back to summary |
|---|---|
| private void bindDelete(DataDictionary dd, FromList fullFromList, FromBaseTable targetTable) throws StandardException Bind a WHEN MATCHED ... THEN DELETE clause | |
| bindExpressions | back to summary |
|---|---|
| private void bindExpressions(ResultColumnList rcl, FromList fromList) throws StandardException Boilerplate for binding a list of ResultColumns against a FromList | |
| bindInsert | back to summary |
|---|---|
| private void bindInsert(DataDictionary dd, MergeNode mergeNode, FromList fullFromList, FromBaseTable targetTable) throws StandardException Bind a WHEN NOT MATCHED ... THEN INSERT clause | |
| bindInsertValues | back to summary |
|---|---|
| private void bindInsertValues(FromList fullFromList, FromTable targetTable) throws StandardException Bind the values in the INSERT list | |
| bindRefinement | back to summary |
|---|---|
| pack-priv void bindRefinement(MergeNode mergeNode, FromList fullFromList) throws StandardException Bind the optional refinement condition in the MATCHED clause | |
| bindSetClauses | back to summary |
|---|---|
| private void bindSetClauses(MergeNode mergeNode, FromList fullFromList, FromTable targetTable, ResultColumnList setClauses) throws StandardException Bind the SET clauses of an UPDATE action | |
| bindUpdate | back to summary |
|---|---|
| private void bindUpdate(DataDictionary dd, MergeNode mergeNode, FromList fullFromList, FromBaseTable targetTable) throws StandardException Bind a WHEN MATCHED ... THEN UPDATE clause | |
| buildFullColumnList | back to summary |
|---|---|
| private ResultColumnList buildFullColumnList(TableDescriptor td) throws StandardException Build the full column list for a table. | |
| buildThenColumnsForDelete | back to summary |
|---|---|
| private void buildThenColumnsForDelete() throws StandardException Construct the signature of the temporary table which drives the INSERT/UPDATE/DELETE action. | |
| buildThenColumnsForInsert | back to summary |
|---|---|
| private void buildThenColumnsForInsert(FromList fullFromList, FromTable targetTable, ResultColumnList fullRow, ResultColumnList insertColumns, ResultColumnList insertValues) throws StandardException Construct the row in the temporary table which drives an INSERT action. Unlike a DELETE, whose temporary row is just a list of copied columns, the temporary row for INSERT may contain complex expressions which must be code-generated later on. | |
| buildThenColumnsForUpdate | back to summary |
|---|---|
| private void buildThenColumnsForUpdate(FromList fullFromList, FromTable targetTable, ResultColumnList fullRow, ResultColumnList beforeRow, ResultColumnList afterValues) throws StandardException Construct the row in the temporary table which drives an UPDATE action. Unlike a DELETE, whose temporary row is just a list of copied columns, the temporary row for UPDATE may contain complex expressions which must be code-generated later on. | |
| buildThenColumnSignature | back to summary |
|---|---|
| private ResultDescription buildThenColumnSignature() throws StandardException Build the signature of the row which will go into the temporary table. | |
| forbidSubqueries | back to summary |
|---|---|
| private void forbidSubqueries() throws StandardException Forbid subqueries in WHEN [ NOT ] MATCHED clauses. | |
| forbidSubqueries | back to summary |
|---|---|
| private void forbidSubqueries(ResultColumnList rcl) throws StandardException | |
| forbidSubqueries | back to summary |
|---|---|
| private void forbidSubqueries(ValueNode expr) throws StandardException | |
| generate | back to summary |
|---|---|
| pack-priv void generate(ActivationClassBuilder acb, ResultColumnList selectList, ResultSetNode generatedScan, HalfOuterJoinNode hojn, int clauseNumber) throws StandardException Generate a method to invoke the INSERT/UPDATE/DELETE action. This method will be called at runtime by MatchingClauseConstantAction.executeConstantAction(). | |
| generateInsertUpdateRow | back to summary |
|---|---|
| private void generateInsertUpdateRow(ActivationClassBuilder acb, ResultColumnList selectList, ResultSetNode generatedScan, HalfOuterJoinNode hojn) throws StandardException Generate a method to build a row for the temporary table for INSERT/UPDATE actions. The method stuffs each column in the row with the result of the corresponding expression built out of columns in the current row of the driving left join. The method returns the stuffed row. | |
| generateResultSetField | back to summary |
|---|---|
| pack-priv void generateResultSetField(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException Adds a field to the generated class to hold the ResultSet of "then" rows which drive the INSERT/UPDATE/DELETE action. Generates code to push the contents of that field onto the stack. | |
| getBoundSelectUnderUpdate | back to summary |
|---|---|
| private ResultSetNode getBoundSelectUnderUpdate() throws StandardException Get the bound SELECT node under the dummy UPDATE node. This may not be the source result set of the UPDATE node. That is because a ProjectRestrictNode may have been inserted on top of it by DEFAULT handling. This method exists to make the UPDATE actions of MERGE statements behave like ordinary UPDATE statements in this situation. The behavior is actually wrong. See DERBY-6414. Depending on how that bug is addressed, we may be able to remove this method eventually. | |
| getChangedColumnNames | back to summary |
|---|---|
| private HashSet Get the names of the columns explicitly changed by SET clauses | |
| getChangedGeneratedColumnNames | back to summary |
|---|---|
| private HashSet Get the names of the generated columns which are changed by the UPDATE statement. These are the generated columns which match one of the following conditions:
| |
| getClauseType | back to summary |
|---|---|
| private int getClauseType() | |
| getColumnReferences | back to summary |
|---|---|
| private List Get a list of column references in an expression | |
| getColumnsInExpressions | back to summary |
|---|---|
| pack-priv void getColumnsInExpressions(MergeNode mergeNode, HashMap<String, ColumnReference> drivingColumnMap) throws StandardException Collect the columns mentioned by expressions in this MATCHED clause | |
| getMergeTableID | back to summary |
|---|---|
| private int getMergeTableID(ColumnReference cr) Find the MERGE table id of the indicated column | |
| getSelectListOffset | back to summary |
|---|---|
| private int getSelectListOffset(ResultColumnList selectList, ValueNode thenExpression) throws StandardException Find a column reference in the SELECT list of the driving left join and return its 1-based offset into that list. Returns -1 if the column can't be found. | |
| getThenColumns | back to summary |
|---|---|
| pack-priv ResultColumnList getThenColumns() Return the list of columns which form the rows of the ResultSet which drive the INSERT/UPDATE/DELETE actions. | |
| isDeleteClause | back to summary |
|---|---|
| pack-priv boolean isDeleteClause() Return true if this is a WHEN MATCHED ... DELETE clause | |
| isInsertClause | back to summary |
|---|---|
| pack-priv boolean isInsertClause() Return true if this is a WHEN NOT MATCHED ... INSERT clause | |
| isRowLocation | back to summary |
|---|---|
| private boolean isRowLocation(ResultColumn rc) throws StandardException Return true if the ResultColumn represents a RowLocation | |
| isUpdateClause | back to summary |
|---|---|
| pack-priv boolean isUpdateClause() Return true if this is a WHEN MATCHED ... UPDATE clause | |
| makeAutoGenRC | back to summary |
|---|---|
| private ResultColumn makeAutoGenRC(FromTable targetTable, ResultColumn origRC, int virtualColumnID) throws StandardException Make a ResultColumn for an identity column which is being set to the DEFAULT value. This special ResultColumn will make it through code generation so that it will be calculated when the INSERT/UPDATE action is run. | |
| makeConstantAction | back to summary |
|---|---|
| pack-priv ConstantAction makeConstantAction(ActivationClassBuilder acb) throws StandardException | |
| makeDeleteClause | back to summary |
|---|---|
| pack-priv static MatchingClauseNode makeDeleteClause(ValueNode matchingRefinement, ContextManager cm) throws StandardException Make a WHEN MATCHED ... THEN DELETE clause | |
| makeInsertClause | back to summary |
|---|---|
| pack-priv static MatchingClauseNode makeInsertClause(ValueNode matchingRefinement, ResultColumnList insertColumns, ResultColumnList insertValues, ContextManager cm) throws StandardException Make a WHEN NOT MATCHED ... THEN INSERT clause | |
| makeUpdateClause | back to summary |
|---|---|
| pack-priv static MatchingClauseNode makeUpdateClause(ValueNode matchingRefinement, ResultColumnList updateColumns, ContextManager cm) throws StandardException Make a WHEN MATCHED ... THEN UPDATE clause | |
| optimize | back to summary |
|---|---|
| pack-priv void optimize() throws StandardException Optimize the INSERT/UPDATE/DELETE action. | |
| printSubNodes | back to summary |
|---|---|
| pack-priv void printSubNodes(int depth) Overrides org. Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.
| |
| realiasSetClauses | back to summary |
|---|---|
| private ResultColumnList realiasSetClauses(FromBaseTable targetTable) throws StandardException Due to discrepancies in how names are resolved by SELECT and UPDATE, we have to force the left side of SET clauses to use the same table identifiers as the right sides of the SET clauses. | |
| referencesSessionSchema | back to summary |
|---|---|
| public boolean referencesSessionSchema() throws StandardException Overrides org. Doc from org. Return true if the node references SESSION schema tables (temporary or permanent)
| |
| referencesSessionSchema | back to summary |
|---|---|
| private static boolean referencesSessionSchema(QueryTreeNode node) throws StandardException | |
| remapConstraints | back to summary |
|---|---|
| private void remapConstraints() throws StandardException Re-map ColumnReferences in constraints to point into the row from the temporary table. This is where the row will be stored when constraints are being evaluated. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing. | |
| useGeneratedScan | back to summary |
|---|---|
| private void useGeneratedScan(ResultColumnList selectList, ResultSetNode generatedScan, QueryTreeNode node) throws StandardException Point a node's ColumnReferences into the row returned by the driving left join. | |