Package org.h2.samples
Class TriggerSample.MyTrigger
- java.lang.Object
-
- org.h2.samples.TriggerSample.MyTrigger
-
- All Implemented Interfaces:
Trigger
- Enclosing class:
- TriggerSample
public static class TriggerSample.MyTrigger extends java.lang.Object implements Trigger
This class is a simple trigger implementation.
-
-
Constructor Summary
Constructors Constructor Description MyTrigger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()This method is called when the database is closed.voidfire(java.sql.Connection conn, java.lang.Object[] oldRow, java.lang.Object[] newRow)This method is called for each triggered action.voidinit(java.sql.Connection conn, java.lang.String schemaName, java.lang.String triggerName, java.lang.String tableName, boolean before, int type)Initializes the trigger.voidremove()This method is called when the trigger is dropped.
-
-
-
Method Detail
-
init
public void init(java.sql.Connection conn, java.lang.String schemaName, java.lang.String triggerName, java.lang.String tableName, boolean before, int type)Initializes the trigger.- Specified by:
initin interfaceTrigger- Parameters:
conn- a connection to the databaseschemaName- the name of the schematriggerName- the name of the trigger used in the CREATE TRIGGER statementtableName- the name of the tablebefore- whether the fire method is called before or after the operation is performedtype- the operation type: INSERT, UPDATE, or DELETE
-
fire
public void fire(java.sql.Connection conn, java.lang.Object[] oldRow, java.lang.Object[] newRow) throws java.sql.SQLExceptionThis method is called for each triggered action.
-
close
public void close()
Description copied from interface:TriggerThis method is called when the database is closed. If the method throws an exception, it will be logged, but closing the database will continue.
-
-