25#ifndef TABLE_TRIGGER_DISPATCHER_H_INCLUDED
26#define TABLE_TRIGGER_DISPATCHER_H_INCLUDED
37#include "mysqld_error.h"
115 bool if_not_exists,
bool &already_exists);
119 bool old_row_is_record1);
195 int field_index)
override {
Definition: sql_list.h:467
Definition: sql_lex.h:2613
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This class holds all information about triggers of a table.
Definition: table_trigger_dispatcher.h:63
Table_trigger_dispatcher(TABLE *subject_table)
Private form of Table_trigger_dispatcher constructor.
Definition: table_trigger_dispatcher.cc:89
Trigger_chain * create_trigger_chain(MEM_ROOT *mem_root, enum_trigger_event_type event, enum_trigger_action_time_type action_time)
Make sure there is a chain for the specified event and action time.
Definition: table_trigger_dispatcher.cc:372
bool has_update_triggers() const
Definition: table_trigger_dispatcher.h:140
void disable_fields_temporary_nullability()
Reset "temporary nullable" flag from trigger fields.
Definition: table_trigger_dispatcher.cc:616
bool m_has_unparseable_trigger
This flag indicates that one of the triggers was not parsed successfully, and as a precaution the obj...
Definition: table_trigger_dispatcher.h:240
bool has_triggers(enum_trigger_event_type event, enum_trigger_action_time_type action_time) const
Definition: table_trigger_dispatcher.h:135
bool process_triggers(THD *thd, enum_trigger_event_type event, enum_trigger_action_time_type action_time, bool old_row_is_record1)
Execute trigger for given (event, time) pair.
Definition: table_trigger_dispatcher.cc:517
void print_upgrade_warnings(THD *thd)
Iterate along triggers and print necessary upgrade warnings.
Definition: table_trigger_dispatcher.cc:631
const Trigger_chain * get_triggers(int event, int action_time) const
Definition: table_trigger_dispatcher.h:127
Field ** m_new_field
During execution of trigger m_new_field and m_old_field should point to the array of fields represent...
Definition: table_trigger_dispatcher.h:222
void set_parse_error_message(const char *error_message)
Remember a parse error that occurred while parsing trigger definitions loaded from the Data Dictionar...
Definition: table_trigger_dispatcher.h:179
Field ** m_record1_field
Copy of TABLE::Field array with field pointers set to TABLE::record[1] buffer instead of TABLE::recor...
Definition: table_trigger_dispatcher.h:214
Trigger * find_trigger(const LEX_STRING &trigger_name)
Get trigger object by trigger name.
Definition: table_trigger_dispatcher.cc:397
bool check_for_broken_triggers()
Checks if there is a broken trigger for this table.
Definition: table_trigger_dispatcher.h:82
Field ** m_old_field
Definition: table_trigger_dispatcher.h:223
bool mark_fields(enum_trigger_event_type event)
Mark fields of subject table which we read/set in its triggers as such.
Definition: table_trigger_dispatcher.cc:662
void enable_fields_temporary_nullability(THD *thd)
Mark all trigger fields as "temporary nullable" and remember the current THD::check_for_truncated_fie...
Definition: table_trigger_dispatcher.cc:588
bool has_delete_triggers() const
Definition: table_trigger_dispatcher.h:145
bool create_trigger(THD *thd, String *binlog_create_trigger_stmt, bool if_not_exists, bool &already_exists)
Create trigger for table.
Definition: table_trigger_dispatcher.cc:115
Field * get_trigger_variable_field(enum_trigger_variable_type v, int field_index) override
Definition: table_trigger_dispatcher.h:194
Trigger_chain * get_triggers(int event, int action_time)
Definition: table_trigger_dispatcher.h:121
static Table_trigger_dispatcher * create(TABLE *subject_table)
Create an instance of Table_trigger_dispatcher for the given subject table.
Definition: table_trigger_dispatcher.cc:79
bool add_tables_and_routines_for_triggers(THD *thd, Query_tables_list *prelocking_ctx, Table_ref *table_list)
Add triggers for table to the set of routines used by statement.
Definition: table_trigger_dispatcher.cc:564
TABLE * get_subject_table() override
Definition: table_trigger_dispatcher.h:192
TABLE * m_subject_table
TABLE instance for which this triggers list object was created.
Definition: table_trigger_dispatcher.h:204
bool prepare_record1_accessors()
Prepare array of Field objects referencing to TABLE::record[1] instead of record<a href="they will re...
Definition: table_trigger_dispatcher.cc:275
char m_parse_error_message[MYSQL_ERRMSG_SIZE]
This error will be displayed when the user tries to manipulate or invoke triggers on a table that has...
Definition: table_trigger_dispatcher.h:247
~Table_trigger_dispatcher() override
Definition: table_trigger_dispatcher.cc:99
Trigger_chain * m_trigger_map[TRG_EVENT_MAX][TRG_ACTION_MAX]
Triggers grouped by event, action_time.
Definition: table_trigger_dispatcher.h:207
bool check_n_load(THD *thd, const dd::Table &table)
Load triggers for the table.
Definition: table_trigger_dispatcher.cc:311
void parse_triggers(THD *thd, List< Trigger > *triggers, bool is_upgrade)
Parse trigger definition statements (CREATE TRIGGER).
Definition: table_trigger_dispatcher.cc:432
This is an interface to be used from Item_trigger_field to access information about table trigger fie...
Definition: table_trigger_field_support.h:44
Definition: trigger_chain.h:41
This class represents a trigger object.
Definition: trigger.h:75
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
void my_message(uint my_err, const char *str, myf MyFlags)
Print an error message.
Definition: my_error.cc:311
Some integer typedefs for easier portability.
#define MYF(v)
Definition: my_inttypes.h:97
Common header for many mysys elements.
Common definition between mysql server & client.
#define MYSQL_ERRMSG_SIZE
Max length of a error message.
Definition: mysql_com.h:881
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
required string event
Definition: replication_group_member_actions.proto:32
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:35
This file defines all base public constants related to triggers in MySQL.
enum_trigger_variable_type
Enum constants to designate NEW and OLD trigger pseudo-variables.
Definition: trigger_def.h:73
@ TRG_OLD_ROW
Definition: trigger_def.h:73
enum_trigger_event_type
Constants to enumerate possible event types on which triggers can be fired.
Definition: trigger_def.h:42
@ TRG_EVENT_UPDATE
Definition: trigger_def.h:44
@ TRG_EVENT_MAX
Definition: trigger_def.h:46
@ TRG_EVENT_DELETE
Definition: trigger_def.h:45
enum_trigger_action_time_type
Constants to enumerate possible timings when triggers can be fired.
Definition: trigger_def.h:52
@ TRG_ACTION_BEFORE
Definition: trigger_def.h:53
@ TRG_ACTION_MAX
Definition: trigger_def.h:55
@ TRG_ACTION_AFTER
Definition: trigger_def.h:54