KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > api > Trigger


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.api;
6
7 import java.sql.Connection JavaDoc;
8 import java.sql.SQLException JavaDoc;
9
10 /**
11  * A class that implements this interface can be used as a trigger.
12  *
13  * @author Thomas
14  */

15
16 public interface Trigger {
17
18     /**
19      * This method is called by the database engine once when initializing the trigger.
20      *
21      * @param conn a connection to the database
22      * @param schemaName the name of the schema
23      * @param triggerName the name of the trigger used in the CREATE TRIGGER statement
24      * @param tableName the name of the table
25      */

26     void init(Connection JavaDoc conn, String JavaDoc schemaName, String JavaDoc triggerName, String JavaDoc tableName) throws SQLException JavaDoc;
27
28     /**
29      * This method is called for each triggered action.
30      *
31      * @param conn a connection to the database
32      * @param oldRow the old row, or null if no old row is available (for INSERT)
33      * @param newRow the new row, or null if no new row is available (for DELETE)
34      * @throws SQLException if the operation must be undone
35      */

36     void fire(Connection JavaDoc conn, Object JavaDoc[] oldRow, Object JavaDoc[] newRow) throws SQLException JavaDoc;
37
38 }
39
Popular Tags