summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_trigger.h')
-rw-r--r--sql/sql_trigger.h50
1 files changed, 41 insertions, 9 deletions
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h
index 1dc573995f1..8f6b08c927f 100644
--- a/sql/sql_trigger.h
+++ b/sql/sql_trigger.h
@@ -17,13 +17,13 @@
/*
This class holds all information about triggers of table.
- QQ: Will it be merged into TABLE in future ?
+ QQ: Will it be merged into TABLE in the future ?
*/
class Table_triggers_list: public Sql_alloc
{
/* Triggers as SPs grouped by event, action_time */
- sp_head *bodies[TRG_EVENT_MAX][TRG_ACTION_MAX];
+ sp_head *bodies[TRG_EVENT_MAX][TRG_ACTION_MAX];
/*
Heads of the lists linking items for all fields used in triggers
grouped by event and action_time.
@@ -75,6 +75,14 @@ public:
List<LEX_STRING> definers_list;
+ /* Character set context, used for parsing and executing triggers. */
+
+ List<LEX_STRING> client_cs_names;
+ List<LEX_STRING> connection_cl_names;
+ List<LEX_STRING> db_cl_names;
+
+ /* End of character ser context. */
+
Table_triggers_list(TABLE *table_arg):
record1_field(0), trigger_table(table_arg)
{
@@ -89,11 +97,26 @@ public:
bool process_triggers(THD *thd, trg_event_type event,
trg_action_time_type time_type,
bool old_row_is_record1);
+
bool get_trigger_info(THD *thd, trg_event_type event,
trg_action_time_type time_type,
LEX_STRING *trigger_name, LEX_STRING *trigger_stmt,
ulong *sql_mode,
- LEX_STRING *definer);
+ LEX_STRING *definer,
+ LEX_STRING *client_cs_name,
+ LEX_STRING *connection_cl_name,
+ LEX_STRING *db_cl_name);
+
+ void get_trigger_info(THD *thd,
+ int trigger_idx,
+ LEX_STRING *trigger_name,
+ ulonglong *sql_mode,
+ LEX_STRING *sql_original_stmt,
+ LEX_STRING *client_cs_name,
+ LEX_STRING *connection_cl_name,
+ LEX_STRING *db_cl_name);
+
+ int find_trigger_by_name(const LEX_STRING *trigger_name);
static bool check_n_load(THD *thd, const char *db, const char *table_name,
TABLE *table, bool names_only);
@@ -115,9 +138,7 @@ public:
void set_table(TABLE *new_table);
- void mark_fields_used(THD *thd, trg_event_type event);
-
- bool is_updated_in_before_update_triggers(Field *fld);
+ void mark_fields_used(trg_event_type event);
friend class Item_trigger_field;
friend int sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
@@ -137,6 +158,17 @@ private:
extern const LEX_STRING trg_action_time_type_names[];
extern const LEX_STRING trg_event_type_names[];
-int
-add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists,
- TABLE_LIST **table);
+bool add_table_for_trigger(THD *thd,
+ const sp_name *trg_name,
+ bool continue_if_not_exist,
+ TABLE_LIST **table);
+
+void build_trn_path(THD *thd, const sp_name *trg_name, LEX_STRING *trn_path);
+
+bool check_trn_exists(const LEX_STRING *trn_path);
+
+bool load_table_name_for_trigger(THD *thd,
+ const sp_name *trg_name,
+ const LEX_STRING *trn_path,
+ LEX_STRING *tbl_name);
+