diff options
author | unknown <dlenev@mysql.com> | 2005-07-19 20:06:49 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2005-07-19 20:06:49 +0400 |
commit | a32bf7fb826950afc5dc679b2ccf770b1d695681 (patch) | |
tree | 2d8dccfe63df5146991d4448c19a59318ba78941 /sql/sql_trigger.h | |
parent | e155a0c01d6c672e92d70abc24e6630a802be391 (diff) | |
download | mariadb-git-a32bf7fb826950afc5dc679b2ccf770b1d695681.tar.gz |
Fix for bugs #5892/6182/8751/8758/10994 (based on Antony's patch)
"Triggers have the wrong namespace"
"Triggers: duplicate names allowed"
"Triggers: CREATE TRIGGER does not accept fully qualified names"
"SHOW TRIGGERS"
mysql-test/r/information_schema.result:
Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
mysql-test/r/information_schema_db.result:
INFORMATION_SCHEMA.TRIGGERS view was added.
mysql-test/r/rpl_sp.result:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
mysql-test/r/trigger.result:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
Added test checking that triggers have database wide namespace.
Added test for bug #8791 "Triggers: Allowed to create triggers on a subject
table in a different DB".
mysql-test/r/view.result:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
mysql-test/t/information_schema.test:
Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
mysql-test/t/rpl_sp.test:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
mysql-test/t/trigger.test:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
Added test checking that triggers have database wide namespace.
Added test for bug #8791 "Triggers: Allowed to create triggers on a subject
table in a different DB".
mysql-test/t/view.test:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
sql/handler.cc:
Added .TRN tho the list of known file extensions assoicated with tables.
sql/item.h:
trg_action_time_type/trg_event_type enums:
Added TRG_ACTION_MAX/TRG_EVENT_MAX elements which should be used instead of
magical values in various loops where we iterate through all types of trigger
action times or/and trigger event types.
sql/lex.h:
Added new symbol "TRIGGERS".
sql/mysql_priv.h:
Added declaration of constant holding extension for trigger name (.TRN) files.
sql/mysqld.cc:
Added statistical variable for SHOW TRIGGERS command.
sql/share/errmsg.txt:
Added error message saying that one attempts to create trigger in wrong schema.
sql/sp.cc:
Replaced magical values with TRG_EVENT_MAX/TRG_ACTION_MAX constants.
sql/sql_base.cc:
open_unireg_entry():
Now Table_triggers_list::check_n_load() has one more argument which
controls whether we should prepare Table_triggers_list with fully functional
triggers or load only their names.
sql/sql_lex.h:
Added element for new SHOW TRIGGERS command to enum_sql_command enum.
sql/sql_parse.cc:
prepare_schema_table():
Added support for SHOW TRIGGERS statement.
sql/sql_show.cc:
Added new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
sql/sql_table.cc:
mysql_rm_table_part2():
Replaced simple deletion of .TRG file with call to
Table_triggers_list::drop_all_triggers which will also delete .TRN files
for all triggers associated with table.
sql/sql_trigger.cc:
Now triggers have database wide namespace. To support it we create special .TRN
file with same name as trigger for each trigger. This file contains name of
trigger's table so one does not need to specify it explicitly in DROP TRIGGER.
Moreover DROP TRIGGER treats first part of trigger identifier as database name
now. Updated mysql_create_or_drop_trigger() routine and
Table_triggers_list::create_trigger()/drop_trigger()/check_n_load() methods
accordingly. Added add_table_for_trigger() routine and
Table_triggers_list::drop_all_triggers() method.
Added Table_triggers_list::get_trigger_info() for obtaining trigger metadata.
sql/sql_trigger.h:
Table_triggers_list:
Use TRG_EVENT_MAX, TRG_ACTION_MAX instead of magic values.
Added get_trigger_info() method for obtaining trigger's meta-data.
Added drop_all_triggers() method which drops all triggers for table.
Added declarations of trg_action_time_type_names/trg_event_type_names
arrays which hold names of triggers action time types and event types.
sql/sql_yacc.yy:
Changed grammar for CREATE/DROP TRIGGER to support database wide trigger
namespace. Added new SHOW TRIGGERS statement.
sql/table.h:
enum enum_schema_tables:
Added constant for new INFORMATION_SCHEMA.TRIGGERS view.
Diffstat (limited to 'sql/sql_trigger.h')
-rw-r--r-- | sql/sql_trigger.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 044219d5ac9..e751741fa34 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -23,7 +23,7 @@ class Table_triggers_list: public Sql_alloc { /* Triggers as SPs grouped by event, action_time */ - sp_head *bodies[3][2]; + sp_head *bodies[TRG_EVENT_MAX][TRG_ACTION_MAX]; /* Copy of TABLE::Field array with field pointers set to TABLE::record[1] buffer instead of TABLE::record[0] (used for OLD values in on UPDATE @@ -121,9 +121,13 @@ public: return res; } + bool get_trigger_info(THD *thd, trg_event_type event, + trg_action_time_type time_type, + LEX_STRING *trigger_name, LEX_STRING *trigger_stmt); static bool check_n_load(THD *thd, const char *db, const char *table_name, - TABLE *table); + TABLE *table, bool names_only); + static bool drop_all_triggers(THD *thd, char *db, char *table_name); bool has_delete_triggers() { @@ -143,3 +147,6 @@ public: private: bool prepare_record1_accessors(TABLE *table); }; + +extern const LEX_STRING trg_action_time_type_names[]; +extern const LEX_STRING trg_event_type_names[]; |