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 SPSDescriptor
private ExecPreparedStatement
private boolean
(package private) final Activation
private final LanguageConnectionContext
private Activation
private Activation
(package private) final InternalTriggerExecutionContext
(package private) final TriggerDescriptor
private SPSDescriptor
private boolean
private ExecPreparedStatement
-
Constructor Summary
ConstructorsConstructorDescriptionGenericTriggerExecutor
(InternalTriggerExecutionContext tec, TriggerDescriptor triggerd, Activation activation, LanguageConnectionContext lcc) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
clearSPS()
Cleanup after executing the SPS for the WHEN clause and trigger action.private boolean
executeSPS
(SPSDescriptor sps, boolean isWhen) Execute the given stored prepared statement.(package private) final void
Execute the WHEN clause SPS and the trigger action SPS.(package private) abstract void
fireTrigger
(TriggerEvent event, CursorResultSet brs, CursorResultSet ars, int[] colsReadFromTable) Fire the trigger based on the event.private SPSDescriptor
private 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
-true
if the SPS is for the WHEN clause,false
otherwise- Returns:
true
if the SPS is for a WHEN clause and it evaluated toTRUE
,false
otherwise- 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
-