Class GenericTriggerExecutor
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.GenericTriggerExecutor
-
- Direct Known Subclasses:
RowTriggerExecutor,StatementTriggerExecutor
abstract class GenericTriggerExecutor extends java.lang.ObjectA trigger executor is an object that executes a trigger. It is subclassed by row and statement executors.
-
-
Field Summary
Fields Modifier and Type Field Description private SPSDescriptoractionprivate ExecPreparedStatementactionPSprivate booleanactionRetrieved(package private) Activationactivationprivate LanguageConnectionContextlccprivate ActivationspsActionActivationprivate ActivationspsWhenActivation(package private) InternalTriggerExecutionContexttec(package private) TriggerDescriptortriggerdprivate SPSDescriptorwhenClauseprivate booleanwhenClauseRetrievedprivate ExecPreparedStatementwhenPS
-
Constructor Summary
Constructors Constructor Description GenericTriggerExecutor(InternalTriggerExecutionContext tec, TriggerDescriptor triggerd, Activation activation, LanguageConnectionContext lcc)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidclearSPS()Cleanup after executing the SPS for the WHEN clause and trigger action.private booleanexecuteSPS(SPSDescriptor sps, boolean isWhen)Execute the given stored prepared statement.(package private) voidexecuteWhenClauseAndAction()Execute the WHEN clause SPS and the trigger action SPS.(package private) abstract voidfireTrigger(TriggerEvent event, CursorResultSet brs, CursorResultSet ars, int[] colsReadFromTable)Fire the trigger based on the event.private SPSDescriptorgetAction()private SPSDescriptorgetWhenClause()
-
-
-
Field Detail
-
tec
final InternalTriggerExecutionContext tec
-
triggerd
final TriggerDescriptor triggerd
-
activation
final Activation activation
-
lcc
private final LanguageConnectionContext lcc
-
whenClauseRetrieved
private boolean whenClauseRetrieved
-
actionRetrieved
private boolean actionRetrieved
-
whenClause
private SPSDescriptor whenClause
-
action
private SPSDescriptor action
-
whenPS
private ExecPreparedStatement whenPS
-
spsWhenActivation
private Activation spsWhenActivation
-
actionPS
private ExecPreparedStatement actionPS
-
spsActionActivation
private Activation spsActionActivation
-
-
Constructor Detail
-
GenericTriggerExecutor
GenericTriggerExecutor(InternalTriggerExecutionContext tec, TriggerDescriptor triggerd, Activation activation, LanguageConnectionContext lcc)
Constructor- Parameters:
tec- the execution contexttriggerd- the trigger descriptoractivation- the activationlcc- the lcc
-
-
Method Detail
-
fireTrigger
abstract void fireTrigger(TriggerEvent event, CursorResultSet brs, CursorResultSet ars, int[] colsReadFromTable) throws StandardException
Fire the trigger based on the event.- Parameters:
event- the trigger eventbrs- the before result setars- the after result setcolsReadFromTable- columns required from the trigger table by the triggering sql- Throws:
StandardException- on error or user exception from trigger action
-
getWhenClause
private SPSDescriptor getWhenClause() throws StandardException
- Throws:
StandardException
-
getAction
private SPSDescriptor getAction() throws StandardException
- Throws:
StandardException
-
executeSPS
private boolean executeSPS(SPSDescriptor sps, boolean isWhen) throws StandardException
Execute the given stored prepared statement. We just grab the prepared statement from the spsd, get a new activation holder and let er rip.- Parameters:
sps- the SPS to executeisWhen-trueif the SPS is for the WHEN clause,falseotherwise- Returns:
trueif the SPS is for a WHEN clause and it evaluated toTRUE,falseotherwise- Throws:
StandardException- on error
-
clearSPS
protected void clearSPS() throws StandardExceptionCleanup after executing the SPS for the WHEN clause and trigger action.- Throws:
StandardException- on error
-
executeWhenClauseAndAction
final void executeWhenClauseAndAction() throws StandardExceptionExecute the WHEN clause SPS and the trigger action SPS.
If there is no WHEN clause, the trigger action should always be executed. If there is a WHEN clause, the trigger action should only be executed if the WHEN clause returns TRUE.
- Throws:
StandardException- if trigger execution fails
-
-