| My Project
   
    | 
#include <sql_trigger.h>
 
  
 | Public Member Functions | |
| Table_triggers_list (TABLE *table_arg) | |
| bool | create_trigger (THD *thd, TABLE_LIST *table, String *stmt_query) | 
| bool | drop_trigger (THD *thd, TABLE_LIST *table, String *stmt_query) | 
| 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, sql_mode_t *sql_mode, 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, sql_mode_t *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) | 
| bool | has_triggers (trg_event_type event_type, trg_action_time_type action_time) | 
| bool | has_delete_triggers () | 
| bool | has_update_triggers () | 
| void | set_table (TABLE *new_table) | 
| void | mark_fields_used (trg_event_type event) | 
| void | set_parse_error_message (char *error_message) | 
| bool | add_tables_and_routines_for_triggers (THD *thd, Query_tables_list *prelocking_ctx, TABLE_LIST *table_list) | 
| bool | is_fields_updated_in_trigger (MY_BITMAP *used_fields, trg_event_type event_type, trg_action_time_type action_time) | 
| Static Public Member Functions | |
| static bool | check_n_load (THD *thd, const char *db, const char *table_name, TABLE *table, bool names_only) | 
| static bool | drop_all_triggers (THD *thd, char *db, char *table_name) | 
| static bool | change_table_name (THD *thd, const char *db, const char *old_alias, const char *old_table, const char *new_db, const char *new_table) | 
| Public Attributes | |
| TABLE * | trigger_table | 
| GRANT_INFO | subject_table_grants [TRG_EVENT_MAX][TRG_ACTION_MAX] | 
| List< LEX_STRING > | definitions_list | 
| List< ulonglong > | definition_modes_list | 
| List< LEX_STRING > | definers_list | 
| List< LEX_STRING > | client_cs_names | 
| List< LEX_STRING > | connection_cl_names | 
| List< LEX_STRING > | db_cl_names | 
| Friends | |
| class | Item_trigger_field | 
This class holds all information about triggers of table.
QQ: Will it be merged into TABLE in the future ?
| bool Table_triggers_list::add_tables_and_routines_for_triggers | ( | THD * | thd, | 
| Query_tables_list * | prelocking_ctx, | ||
| TABLE_LIST * | table_list | ||
| ) | 
Add triggers for table to the set of routines used by statement. Add tables used by them to statement table list. Do the same for routines used by triggers.
| thd | Thread context. | 
| prelocking_ctx | Prelocking context of the statement. | 
| table_list | Table list element for table with trigger. | 
| FALSE | Success. | 
| TRUE | Failure. | 
| bool Table_triggers_list::change_table_name | ( | THD * | thd, | 
| const char * | db, | ||
| const char * | old_alias, | ||
| const char * | old_table, | ||
| const char * | new_db, | ||
| const char * | new_table | ||
| ) |  [static] | 
Update .TRG and .TRN files after renaming triggers' subject table.
| [in,out] | thd | Thread context | 
| [in] | db | Old database of subject table | 
| [in] | old_alias | Old alias of subject table | 
| [in] | old_table | Old name of subject table | 
| [in] | new_db | New database for subject table | 
| [in] | new_table | New name of subject table | 
| FALSE | Success | 
| TRUE | Error | 
| bool Table_triggers_list::check_n_load | ( | THD * | thd, | 
| const char * | db, | ||
| const char * | table_name, | ||
| TABLE * | table, | ||
| bool | names_only | ||
| ) |  [static] | 
Check whenever .TRG file for table exist and load all triggers it contains.
| thd | current thread context | 
| db | table's database name | 
| table_name | table's name | 
| table | pointer to table object | 
| names_only | stop after loading trigger names | 
| False | success | 
| True | error | 
| bool Table_triggers_list::create_trigger | ( | THD * | thd, | 
| TABLE_LIST * | tables, | ||
| String * | stmt_query | ||
| ) | 
Create trigger for table.
| thd | current thread context (including trigger definition in LEX) | |
| tables | table list containing one open table for which the trigger is created. | |
| [out] | stmt_query | after successful return, this string contains well-formed statement for creation this trigger. | 
| False | success | 
| True | error | 
| bool Table_triggers_list::drop_all_triggers | ( | THD * | thd, | 
| char * | db, | ||
| char * | name | ||
| ) |  [static] | 
Drop all triggers for table.
| thd | current thread context | 
| db | schema for table | 
| name | name for table | 
| False | success | 
| True | error | 
| bool Table_triggers_list::drop_trigger | ( | THD * | thd, | 
| TABLE_LIST * | tables, | ||
| String * | stmt_query | ||
| ) | 
Drop trigger for table.
| thd | current thread context (including trigger definition in LEX) | |
| tables | table list containing one open table for which trigger is dropped. | |
| [out] | stmt_query | after successful return, this string contains well-formed statement for creation this trigger. | 
| False | success | 
| True | error | 
| bool Table_triggers_list::get_trigger_info | ( | THD * | thd, | 
| trg_event_type | event, | ||
| trg_action_time_type | time_type, | ||
| LEX_STRING * | trigger_name, | ||
| LEX_STRING * | trigger_stmt, | ||
| sql_mode_t * | sql_mode, | ||
| LEX_STRING * | definer, | ||
| LEX_STRING * | client_cs_name, | ||
| LEX_STRING * | connection_cl_name, | ||
| LEX_STRING * | db_cl_name | ||
| ) | 
Obtains and returns trigger metadata.
| thd | current thread context | 
| event | trigger event type | 
| time_type | trigger action time | 
| trigger_name | returns name of trigger | 
| trigger_stmt | returns statement of trigger | 
| sql_mode | returns sql_mode of trigger | 
| definer | returns definer/creator of trigger. The caller is responsible to allocate enough space for storing definer information. | 
| False | success | 
| True | error | 
| bool Table_triggers_list::is_fields_updated_in_trigger | ( | MY_BITMAP * | used_fields, | 
| trg_event_type | event_type, | ||
| trg_action_time_type | action_time | ||
| ) | 
Check if any of the marked fields are used in the trigger.
| used_fields | Bitmap over fields to check | 
| event_type | Type of event triggers for which we are going to inspect | 
| action_time | Type of trigger action time we are going to inspect | 
| void Table_triggers_list::mark_fields_used | ( | trg_event_type | event | ) | 
Mark fields of subject table which we read/set in its triggers as such.
This method marks fields of subject table which are read/set in its triggers as such (by properly updating TABLE::read_set/write_set) and thus informs handler that values for these fields should be retrieved/stored during execution of statement.
| event | Type of event triggers for which we are going to inspect | 
| bool Table_triggers_list::process_triggers | ( | THD * | thd, | 
| trg_event_type | event, | ||
| trg_action_time_type | time_type, | ||
| bool | old_row_is_record1 | ||
| ) | 
Execute trigger for given (event, time) pair.
The operation executes trigger for the specified event (insert, update, delete) and time (after, before) if it is set.
| thd | |
| event | |
| time_type | |
| old_row_is_record1 | 
| FALSE | on success. | 
| TRUE | on error. | 
| void Table_triggers_list::set_parse_error_message | ( | char * | error_message | ) | 
Signals to the Table_triggers_list that a parse error has occured when reading a trigger from file. This makes the Table_triggers_list enter an error state flagged by m_has_unparseable_trigger == true. The error message will be used whenever a statement invoking or manipulating triggers is issued against the Table_triggers_list's table.
| error_message | The error message thrown by the parser. | 
| void Table_triggers_list::set_table | ( | TABLE * | new_table | ) | 
Adjust Table_triggers_list with new TABLE pointer.
| new_table | new pointer to TABLE instance | 
| List<ulonglong> Table_triggers_list::definition_modes_list | 
List of sql modes for triggers
| List<LEX_STRING> Table_triggers_list::definitions_list | 
Field responsible for storing triggers definitions in file. It have to be public because we are using it directly from parser.
| GRANT_INFO Table_triggers_list::subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX] | 
Grant information for each trigger (pair: subject table, trigger definer).
TABLE instance for which this triggers list object was created.
 1.7.6.1
 1.7.6.1