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