Class GenericTriggerExecutor
java.lang.Object
org.apache.derby.impl.sql.execute.GenericTriggerExecutor
- Direct Known Subclasses:
RowTriggerExecutor, StatementTriggerExecutor
A trigger executor is an object that executes
a trigger. It is subclassed by row and statement
executors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SPSDescriptorprivate ExecPreparedStatementprivate boolean(package private) final Activationprivate final LanguageConnectionContextprivate Activationprivate Activation(package private) final InternalTriggerExecutionContext(package private) final TriggerDescriptorprivate SPSDescriptorprivate booleanprivate ExecPreparedStatement -
Constructor Summary
ConstructorsConstructorDescriptionGenericTriggerExecutor(InternalTriggerExecutionContext tec, TriggerDescriptor triggerd, Activation activation, LanguageConnectionContext lcc) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected 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) final voidExecute 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 SPSDescriptorprivate SPSDescriptor
-
Field Details
-
tec
-
triggerd
-
activation
-
lcc
-
whenClauseRetrieved
private boolean whenClauseRetrieved -
actionRetrieved
private boolean actionRetrieved -
whenClause
-
action
-
whenPS
-
spsWhenActivation
-
actionPS
-
spsActionActivation
-
-
Constructor Details
-
GenericTriggerExecutor
GenericTriggerExecutor(InternalTriggerExecutionContext tec, TriggerDescriptor triggerd, Activation activation, LanguageConnectionContext lcc) Constructor- Parameters:
tec- the execution contexttriggerd- the trigger descriptoractivation- the activationlcc- the lcc
-
-
Method Details
-
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
- Throws:
StandardException
-
getAction
- Throws:
StandardException
-
executeSPS
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
Cleanup after executing the SPS for the WHEN clause and trigger action.- Throws:
StandardException- on error
-
executeWhenClauseAndAction
Execute 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
-