提交 739e2a0d authored 作者: Thomas Mueller's avatar Thomas Mueller

The interface CloseListener has a new method 'remove' that is called when the trigger is dropped.

上级 f6940b7f
......@@ -22,5 +22,12 @@ public interface CloseListener {
* @throws SQLException
*/
void close() throws SQLException;
/**
* This method is called when the trigger is dropped.
*
* @throws SQLException
*/
void remove() throws SQLException;
}
......@@ -33,19 +33,14 @@ public interface Trigger {
* This method is called by the database engine once when initializing the
* trigger.
*
* @param conn
* a connection to the database
* @param schemaName
* the name of the schema
* @param triggerName
* the name of the trigger used in the CREATE TRIGGER statement
* @param tableName
* the name of the table
* @param before
* whether the fire method is called before or after the
* @param conn a connection to the database
* @param schemaName the name of the schema
* @param triggerName the name of the trigger used in the CREATE TRIGGER
* statement
* @param tableName the name of the table
* @param before whether the fire method is called before or after the
* operation is performed
* @param type
* the operation type: INSERT, UPDATE, or DELETE
* @param type the operation type: INSERT, UPDATE, or DELETE
*/
void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type)
throws SQLException;
......@@ -53,14 +48,12 @@ public interface Trigger {
/**
* This method is called for each triggered action.
*
* @param conn
* a connection to the database
* @param oldRow
* the old row, or null if no old row is available (for INSERT)
* @param newRow
* the new row, or null if no new row is available (for DELETE)
* @throws SQLException
* if the operation must be undone
* @param conn a connection to the database
* @param oldRow the old row, or null if no old row is available (for
* INSERT)
* @param newRow the new row, or null if no new row is available (for
* DELETE)
* @throws SQLException if the operation must be undone
*/
void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException;
......
......@@ -285,6 +285,11 @@ public class TriggerObject extends SchemaObjectBase {
public void removeChildrenAndResources(Session session) throws SQLException {
table.removeTrigger(this);
database.removeMeta(session, getId());
if (triggerCallback != null) {
if (triggerCallback instanceof CloseListener) {
((CloseListener) triggerCallback).remove();
}
}
table = null;
triggerClassName = null;
triggerCallback = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论