Class GenericTriggerExecutor
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.GenericTriggerExecutor
-
- Direct Known Subclasses:
RowTriggerExecutor
,StatementTriggerExecutor
abstract class GenericTriggerExecutor extends java.lang.Object
A 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 SPSDescriptor
action
private ExecPreparedStatement
actionPS
private boolean
actionRetrieved
(package private) Activation
activation
private LanguageConnectionContext
lcc
private Activation
spsActionActivation
private Activation
spsWhenActivation
(package private) InternalTriggerExecutionContext
tec
(package private) TriggerDescriptor
triggerd
private SPSDescriptor
whenClause
private boolean
whenClauseRetrieved
private ExecPreparedStatement
whenPS
-
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 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) void
executeWhenClauseAndAction()
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
getAction()
private SPSDescriptor
getWhenClause()
-
-
-
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
-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
protected void clearSPS() throws StandardException
Cleanup after executing the SPS for the WHEN clause and trigger action.- Throws:
StandardException
- on error
-
executeWhenClauseAndAction
final void executeWhenClauseAndAction() throws StandardException
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
-
-