Class MatchingClauseConstantAction
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.MatchingClauseConstantAction
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,Formatable,TypedFormat,ConstantAction
public class MatchingClauseConstantAction extends java.lang.Object implements ConstantAction, Formatable
Describes the execution machinery needed to evaluate a WHEN [ NOT ] MATCHING clause of a MERGE statement.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String_actionMethodNameprivate ResultSet_actionRSprivate int_clauseTypeprivate GeneratedMethod_matchRefinementMethodprivate java.lang.String_matchRefinementNameprivate java.lang.String_resultSetFieldNameprivate GeneratedMethod_rowMakingMethodprivate java.lang.String_rowMakingMethodNameprivate ConstantAction_thenActionprivate ResultDescription_thenColumnSignatureprivate static intFIRST_VERSIONprivate static longserialVersionUIDSerial version produced by the serialver utility.-
Fields inherited from interface org.apache.derby.iapi.sql.execute.ConstantAction
WHEN_MATCHED_THEN_DELETE, WHEN_MATCHED_THEN_UPDATE, WHEN_NOT_MATCHED_THEN_INSERT
-
-
Constructor Summary
Constructors Constructor Description MatchingClauseConstantAction()0-arg constructor needed by Formatable machineryMatchingClauseConstantAction(int clauseType, java.lang.String matchRefinementName, ResultDescription thenColumnSignature, java.lang.String rowMakingMethodName, java.lang.String resultSetFieldName, java.lang.String actionMethodName, ConstantAction thenAction)Construct from thin air.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ExecRowbufferThenRow(Activation activation)Construct and buffer a row for the INSERT/UPDATE/DELETE action corresponding to this [ NOT ] MATCHED clause.(package private) TemporaryRowHolderImplbufferThenRow(Activation activation, TemporaryRowHolderImpl thenRows, ExecRow selectRow)Construct and buffer a row for the INSERT/UPDATE/DELETE action corresponding to this [ NOT ] MATCHED clause.intclauseType()Get the clause type: WHEN_NOT_MATCHED_THEN_INSERT, WHEN_MATCHED_THEN_UPDATE, WHEN_MATCHED_THEN_DELETE(package private) voidcleanUp()Release resources at the end.private TemporaryRowHolderImplcreateThenRows(Activation activation)Create the temporary table for holding the rows which are buffered up for bulk-processing after the driving left join completes.(package private) booleanevaluateRefinementClause(Activation activation)Run the matching refinement clause associated with this WHEN [ NOT ] MATCHED clause.voidexecuteConstantAction(Activation activation)Run the ConstantAction.voidexecuteConstantAction(Activation activation, TemporaryRowHolderImpl thenRows)intgetTypeFormatId()Get the formatID which corresponds to this class.(package private) voidinit()Initialize this constant action, nulling out any transient state left over from a previous use.voidreadExternal(java.io.ObjectInput in)Read this object from a stream of stored objects.voidwriteExternal(java.io.ObjectOutput out)Write this object to a stream of stored objects.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version produced by the serialver utility. Needed in order to make serialization work reliably across different compilers.- See Also:
- Constant Field Values
-
FIRST_VERSION
private static final int FIRST_VERSION
- See Also:
- Constant Field Values
-
_clauseType
private int _clauseType
-
_matchRefinementName
private java.lang.String _matchRefinementName
-
_thenColumnSignature
private ResultDescription _thenColumnSignature
-
_rowMakingMethodName
private java.lang.String _rowMakingMethodName
-
_resultSetFieldName
private java.lang.String _resultSetFieldName
-
_actionMethodName
private java.lang.String _actionMethodName
-
_thenAction
private ConstantAction _thenAction
-
_matchRefinementMethod
private transient GeneratedMethod _matchRefinementMethod
-
_rowMakingMethod
private transient GeneratedMethod _rowMakingMethod
-
_actionRS
private transient ResultSet _actionRS
-
-
Constructor Detail
-
MatchingClauseConstantAction
public MatchingClauseConstantAction()
0-arg constructor needed by Formatable machinery
-
MatchingClauseConstantAction
public MatchingClauseConstantAction(int clauseType, java.lang.String matchRefinementName, ResultDescription thenColumnSignature, java.lang.String rowMakingMethodName, java.lang.String resultSetFieldName, java.lang.String actionMethodName, ConstantAction thenAction)Construct from thin air.- Parameters:
clauseType- WHEN_NOT_MATCHED_THEN_INSERT, WHEN_MATCHED_THEN_UPDATE, WHEN_MATCHED_THEN_DELETEmatchRefinementName- Name of the method which evaluates the boolean expression in the WHEN clause.thenColumnSignature- The shape of the row which goes into the temporary table.rowMakingMethodName- Name of the method which populates the "then" row with expressions from the driving left join.resultSetFieldName- Name of the field which will be stuffed at runtime with the temporary table of relevant rows.actionMethodName- Name of the method which invokes the INSERT/UPDATE/DELETE action.thenAction- The ConstantAction describing the associated INSERT/UPDATE/DELETE action.
-
-
Method Detail
-
clauseType
public int clauseType()
Get the clause type: WHEN_NOT_MATCHED_THEN_INSERT, WHEN_MATCHED_THEN_UPDATE, WHEN_MATCHED_THEN_DELETE
-
executeConstantAction
public void executeConstantAction(Activation activation) throws StandardException
Description copied from interface:ConstantActionRun the ConstantAction.- Specified by:
executeConstantActionin interfaceConstantAction- Parameters:
activation- The execution environment for this constant action.- Throws:
StandardException- Thrown on failure
-
executeConstantAction
public void executeConstantAction(Activation activation, TemporaryRowHolderImpl thenRows) throws StandardException
- Throws:
StandardException
-
init
void init() throws StandardException
Initialize this constant action, nulling out any transient state left over from a previous use.
- Throws:
StandardException
-
evaluateRefinementClause
boolean evaluateRefinementClause(Activation activation) throws StandardException
Run the matching refinement clause associated with this WHEN [ NOT ] MATCHED clause. The refinement is a boolean expression. Return the boolean value it resolves to. A boolean NULL is treated as false. If there is no refinement clause, then this method evaluates to true.
- Throws:
StandardException
-
bufferThenRow
TemporaryRowHolderImpl bufferThenRow(Activation activation, TemporaryRowHolderImpl thenRows, ExecRow selectRow) throws StandardException
Construct and buffer a row for the INSERT/UPDATE/DELETE action corresponding to this [ NOT ] MATCHED clause. The buffered row is built from columns in the passed-in row. The passed-in row is the SELECT list of the MERGE statement's driving left join.
- Throws:
StandardException
-
cleanUp
void cleanUp() throws StandardExceptionRelease resources at the end.
- Throws:
StandardException
-
bufferThenRow
private ExecRow bufferThenRow(Activation activation) throws StandardException
Construct and buffer a row for the INSERT/UPDATE/DELETE action corresponding to this [ NOT ] MATCHED clause.
- Throws:
StandardException
-
createThenRows
private TemporaryRowHolderImpl createThenRows(Activation activation) throws StandardException
Create the temporary table for holding the rows which are buffered up for bulk-processing after the driving left join completes.
- Throws:
StandardException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this object from a stream of stored objects.- Specified by:
readExternalin interfacejava.io.Externalizable- Parameters:
in- read this.- Throws:
java.io.IOException- thrown on errorjava.lang.ClassNotFoundException- thrown on error
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionWrite this object to a stream of stored objects.- Specified by:
writeExternalin interfacejava.io.Externalizable- Parameters:
out- write bytes here.- Throws:
java.io.IOException- thrown on error
-
getTypeFormatId
public int getTypeFormatId()
Get the formatID which corresponds to this class.- Specified by:
getTypeFormatIdin interfaceTypedFormat- Returns:
- the formatID of this class
-
-