Top Description Fields Methods
org.hsqldb.trigger

public Interface Trigger

Known Direct Subinterfaces
org.hsqldb.Trigger
Known Direct Implementers
org.hsqldb.TriggerDef.DefaultTrigger
Imports
org.hsqldb.HsqlException

The interface a HyperSQL TRIGGER must implement. The user-supplied class that implements this must have a default constructor.

Contents of oldRow[] and newRow[] in each type of trigger.

(List compiled by Andrew Knight quozzbat@users)
Author
Peter Hudson (peterhudson@users dot sourceforge.net)
Since
1.7.0
Version
1.9.0

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public default void
fire(int
the type as one of the int values defined in the interface
type
,
String
the name of the trigger
triggerName
,
String
the name of the table upon which the triggered action is occurring
tableName
,
String[]
names of the columns of the table
columnNames
,
Object[]
the old row
oldRow
,
Object[]
the new row
newRow
)

The method invoked upon each triggered action.

public default void
fire(int
the type as one of the int values defined in the interface
type
,
String
the name of the trigger
triggerName
,
String
the name of the table upon which the triggered action is occurring
tableName
,
Object[]
the old row
oldRow
,
Object[]
the new row
newRow
)

Old fire method.

Field Detail

DELETE_AFTERback to summary
public static final int DELETE_AFTER
DELETE_AFTER_ROWback to summary
public static final int DELETE_AFTER_ROW
DELETE_BEFORE_ROWback to summary
public static final int DELETE_BEFORE_ROW
INSERT_AFTERback to summary
public static final int INSERT_AFTER
INSERT_AFTER_ROWback to summary
public static final int INSERT_AFTER_ROW
INSERT_BEFORE_ROWback to summary
public static final int INSERT_BEFORE_ROW
UPDATE_AFTERback to summary
public static final int UPDATE_AFTER
UPDATE_AFTER_ROWback to summary
public static final int UPDATE_AFTER_ROW
UPDATE_BEFORE_ROWback to summary
public static final int UPDATE_BEFORE_ROW

Method Detail

fireback to summary
public default void fire(int type, String triggerName, String tableName, String[] columnNames, Object[] oldRow, Object[] newRow)

The method invoked upon each triggered action.

type contains the integer index id for trigger type, e.g. TriggerDef.INSERT_AFTER

For all triggers defined as default FOR EACH STATEMENT both oldRow and newRow are null.

For triggers defined as FOR EACH ROW, the following will apply:

When UPDATE triggers are fired, oldRow contains the existing values of the table row and newRow contains the new values.

For INSERT triggers, oldRow is null and newRow contains the table row to be inserted. For DELETE triggers, newRow is null and oldRow contains the table row to be deleted.

For error conditions, users can construct an HsqlException using one of the static methods of org.hsqldb.error.Error with a predefined SQL State from org.hsqldb.error.ErrorCode.

Parameters
type:int

the type as one of the int values defined in the interface

triggerName:String

the name of the trigger

tableName:String

the name of the table upon which the triggered action is occurring

columnNames:String[]

names of the columns of the table

oldRow:Object[]

the old row

newRow:Object[]

the new row

Exceptions
HsqlException:
the preferred type of exception thrown by the method
fireback to summary
public default void fire(int type, String triggerName, String tableName, Object[] oldRow, Object[] newRow)

Old fire method.

Parameters
type:int

the type as one of the int values defined in the interface

triggerName:String

the name of the trigger

tableName:String

the name of the table upon which the triggered action is occurring

oldRow:Object[]

the old row

newRow:Object[]

the new row

Exceptions
HsqlException:
the preferred type of exception thrown by the method