Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

pack-priv abstract Class GenericTriggerExecutor

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.execute.RowTriggerExecutor, org.apache.derby.impl.sql.execute.StatementTriggerExecutor
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.dictionary.SPSDescriptor, .TriggerDescriptor, org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecPreparedStatement, .ExecRow, org.apache.derby.iapi.sql.Activation, .ResultSet, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .StatementContext, org.apache.derby.iapi.types.DataValueDescriptor, .SQLBoolean, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager

A trigger executor is an object that executes a trigger. It is subclassed by row and statement executors.

Field Summary

Modifier and TypeField and Description
private SPSDescriptor
private ExecPreparedStatement
private boolean
pack-priv final Activation
private final LanguageConnectionContext
private Activation
private Activation
pack-priv final InternalTriggerExecutionContext
pack-priv final TriggerDescriptor
private SPSDescriptor
private boolean
private ExecPreparedStatement

Constructor Summary

AccessConstructor and Description
pack-priv
GenericTriggerExecutor(InternalTriggerExecutionContext
the execution context
tec
,
TriggerDescriptor
the trigger descriptor
triggerd
,
Activation
the activation
activation
,
LanguageConnectionContext
the lcc
lcc
)

Constructor

Method Summary

Modifier and TypeMethod and Description
protected void
clearSPS()

Cleanup after executing the SPS for the WHEN clause and trigger action.

private boolean

Returns:

true if the SPS is for a WHEN clause and it evaluated to TRUE, false otherwise
executeSPS
(SPSDescriptor
the SPS to execute
sps
,
boolean
true if the SPS is for the WHEN clause, false otherwise
isWhen
)

Execute the given stored prepared statement.

pack-priv final void
executeWhenClauseAndAction()

Execute the WHEN clause SPS and the trigger action SPS.

pack-priv abstract void
fireTrigger(TriggerEvent
the trigger event
event
,
CursorResultSet
the before result set
brs
,
CursorResultSet
the after result set
ars
,
int[]
columns required from the trigger table by the triggering sql
colsReadFromTable
)

Fire the trigger based on the event.

private SPSDescriptor
private SPSDescriptor
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

actionback to summary
private SPSDescriptor action
actionPSback to summary
private ExecPreparedStatement actionPS
actionRetrievedback to summary
private boolean actionRetrieved
activationback to summary
pack-priv final Activation activation
lccback to summary
private final LanguageConnectionContext lcc
spsActionActivationback to summary
private Activation spsActionActivation
spsWhenActivationback to summary
private Activation spsWhenActivation
tecback to summary
pack-priv final InternalTriggerExecutionContext tec
triggerdback to summary
pack-priv final TriggerDescriptor triggerd
whenClauseback to summary
private SPSDescriptor whenClause
whenClauseRetrievedback to summary
private boolean whenClauseRetrieved
whenPSback to summary
private ExecPreparedStatement whenPS

Constructor Detail

GenericTriggerExecutorback to summary
pack-priv GenericTriggerExecutor(InternalTriggerExecutionContext tec, TriggerDescriptor triggerd, Activation activation, LanguageConnectionContext lcc)

Constructor

Parameters
tec:InternalTriggerExecutionContext

the execution context

triggerd:TriggerDescriptor

the trigger descriptor

activation:Activation

the activation

lcc:LanguageConnectionContext

the lcc

Method Detail

clearSPSback to summary
protected void clearSPS() throws StandardException

Cleanup after executing the SPS for the WHEN clause and trigger action.

Exceptions
StandardException:
on error
executeSPSback to summary
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:SPSDescriptor

the SPS to execute

isWhen:boolean

true if the SPS is for the WHEN clause, false otherwise

Returns:boolean

true if the SPS is for a WHEN clause and it evaluated to TRUE, false otherwise

Exceptions
StandardException:
on error
executeWhenClauseAndActionback to summary
pack-priv 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.

Exceptions
StandardException:
if trigger execution fails
fireTriggerback to summary
pack-priv abstract void fireTrigger(TriggerEvent event, CursorResultSet brs, CursorResultSet ars, int[] colsReadFromTable) throws StandardException

Fire the trigger based on the event.

Parameters
event:TriggerEvent

the trigger event

brs:CursorResultSet

the before result set

ars:CursorResultSet

the after result set

colsReadFromTable:int[]

columns required from the trigger table by the triggering sql

Exceptions
StandardException:
on error or user exception from trigger action
getActionback to summary
private SPSDescriptor getAction() throws StandardException
getWhenClauseback to summary
private SPSDescriptor getWhenClause() throws StandardException