25#ifndef TRIGGER_H_INCLUDED
26#define TRIGGER_H_INCLUDED
77 String *binlog_create_trigger_stmt);
133 bool parse(
THD *thd,
bool is_upgrade);
217 String *full_trigger_definition)
const;
Definition: sql_lex.h:2507
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
This class represents a trigger object.
Definition: trigger.h:74
sp_head * m_sp
Pointer to the sp_head corresponding to the trigger.
Definition: trigger.h:344
GRANT_INFO * get_subject_table_grant()
Definition: trigger.h:198
bool has_parse_error() const
Definition: trigger.h:200
enum_trigger_event_type m_event
Trigger event.
Definition: trigger.h:306
LEX_CSTRING m_client_cs_name
Character set context, used for parsing and executing trigger.
Definition: trigger.h:297
ulonglong get_action_order() const
Definition: trigger.h:190
LEX_CSTRING m_db_name
Database name.
Definition: trigger.h:273
LEX_CSTRING m_connection_cl_name
Collation name of the connection within one a trigger are created.
Definition: trigger.h:300
enum_trigger_action_time_type get_action_time() const
Definition: trigger.h:177
const LEX_CSTRING & get_definer_user() const
Definition: trigger.h:161
~Trigger()
Destroy associated SP (if any).
Definition: trigger.cc:360
LEX_CSTRING m_definition_utf8
Trigger definition in UTF8 to save in DD.
Definition: trigger.h:282
my_timeval m_created_timestamp
Current time when the trigger was created (measured in milliseconds since since 0 hours,...
Definition: trigger.h:318
static Trigger * create_from_dd(MEM_ROOT *mem_root, const LEX_CSTRING &trigger_name, const LEX_CSTRING &db_name, const LEX_CSTRING &subject_table_name, const LEX_CSTRING &definition, const LEX_CSTRING &definition_utf8, sql_mode_t sql_mode, const LEX_CSTRING &definer_user, const LEX_CSTRING &definer_host, const LEX_CSTRING &client_cs_name, const LEX_CSTRING &connection_cl_name, const LEX_CSTRING &db_cl_name, enum_trigger_event_type trg_event_type, enum_trigger_action_time_type trg_time_type, uint action_order, my_timeval created_timestamp)
Creates a new Trigger-instance with the state loaded from the Data Dictionary.
Definition: trigger.cc:304
const LEX_CSTRING & get_action_time_as_string() const
Definition: trigger.cc:152
void set_action_order(ulonglong action_order)
Definition: trigger.h:192
bool m_has_parse_error
This flags specifies whether the trigger has parse error or not.
Definition: trigger.h:347
bool parse(THD *thd, bool is_upgrade)
Parse CREATE TRIGGER statement.
Definition: trigger.cc:432
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: trigger.h:355
bool create_full_trigger_definition(const THD *thd, String *full_trigger_definition) const
Construct a full CREATE TRIGGER statement from Trigger's data members.
Definition: trigger.cc:397
ulonglong m_action_order
Action_order value for the trigger.
Definition: trigger.h:325
my_timeval get_created_timestamp() const
Definition: trigger.h:188
const LEX_CSTRING & get_trigger_name() const
Definition: trigger.h:151
const char * get_parse_error_message() const
Definition: trigger.h:202
const LEX_CSTRING & get_definition_utf8() const
Definition: trigger.h:155
LEX_CSTRING m_trigger_name
Trigger name.
Definition: trigger.h:333
LEX_CSTRING m_db_cl_name
Default database collation.
Definition: trigger.h:303
const LEX_CSTRING & get_definer() const
Definition: trigger.h:159
sql_mode_t m_sql_mode
Trigger sql-mode.
Definition: trigger.h:285
LEX_CSTRING m_definition
Trigger definition to save in DD.
Definition: trigger.h:279
bool execute(THD *thd)
Execute trigger's body.
Definition: trigger.cc:372
MEM_ROOT * m_mem_root
Memory root to store all data of this Trigger object.
Definition: trigger.h:258
const LEX_CSTRING & get_db_cl_name() const
Definition: trigger.h:171
enum_trigger_event_type get_event() const
Definition: trigger.h:173
void set_trigger_def_utf8(const LEX_CSTRING &trigger_def_utf8)
Definition: trigger.h:242
void add_tables_and_routines(THD *thd, Query_tables_list *prelocking_ctx, Table_ref *table_list)
Add tables and routines used by trigger to the set of elements used by statement.
Definition: trigger.cc:623
LEX_CSTRING m_definer
Trigger definer.
Definition: trigger.h:288
const LEX_CSTRING & get_definition() const
Definition: trigger.h:153
bool is_created_timestamp_null() const
Definition: trigger.h:183
LEX_CSTRING m_subject_table_name
Table name.
Definition: trigger.h:276
void set_parse_error_message(const char *error_message)
Definition: trigger.h:246
sql_mode_t get_sql_mode() const
Definition: trigger.h:157
LEX_CSTRING m_definer_user
Trigger definer (user part).
Definition: trigger.h:291
const LEX_CSTRING & get_connection_cl_name() const
Definition: trigger.h:167
Trigger(const LEX_CSTRING &trigger_name, MEM_ROOT *mem_root, const LEX_CSTRING &db_name, const LEX_CSTRING &table_name, const LEX_CSTRING &definition, const LEX_CSTRING &definition_utf8, sql_mode_t sql_mode, const LEX_CSTRING &definer_user, const LEX_CSTRING &definer_host, const LEX_CSTRING &client_cs_name, const LEX_CSTRING &connection_cl_name, const LEX_CSTRING &db_cl_name, enum_trigger_event_type event_type, enum_trigger_action_time_type action_time, uint action_order, my_timeval created_timestamp)
Trigger constructor.
Definition: trigger.cc:324
LEX_CSTRING m_definer_host
Trigger definer (host part).
Definition: trigger.h:294
void set_trigger_def(const LEX_CSTRING &trigger_def)
Definition: trigger.h:238
GRANT_INFO m_subject_table_grant
Grant information for the trigger.
Definition: trigger.h:341
const LEX_CSTRING & get_subject_table_name() const
Definition: trigger.h:147
const LEX_CSTRING & get_event_as_string() const
Definition: trigger.cc:156
const LEX_CSTRING & get_db_name() const
Definition: trigger.h:145
static bool construct_create_trigger_stmt_with_definer(THD *thd, String *binlog_query, const LEX_CSTRING &def_user, const LEX_CSTRING &def_host)
Constructs CREATE TRIGGER statement taking into account a value of the DEFINER clause.
Definition: trigger.cc:126
const LEX_CSTRING & get_definer_host() const
Definition: trigger.h:163
const LEX_CSTRING & get_client_cs_name() const
Definition: trigger.h:165
void print_upgrade_warning(THD *thd)
Print upgrade warnings (if any).
Definition: trigger.cc:666
LEX_CSTRING m_full_trigger_definition
Full trigger definition reconstructed from a data loaded from the table mysql.trigger.
Definition: trigger.h:264
enum_trigger_action_time_type m_action_time
Trigger action time.
Definition: trigger.h:309
sp_head * get_sp()
Definition: trigger.h:196
void set_trigger_name(const LEX_CSTRING &trigger_name)
Definition: trigger.h:234
static Trigger * create_from_parser(THD *thd, TABLE *subject_table, String *binlog_create_trigger_stmt)
Creates a new Trigger-instance with the state from the parser.
Definition: trigger.cc:180
sp_head represents one instance of a stored program.
Definition: sp_head.h:380
static MEM_ROOT mem_root
Definition: client_plugin.cc:110
ulonglong sql_mode_t
Definition: dd_event.h:37
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Common definition between mysql server & client.
#define MYSQL_ERRMSG_SIZE
Max length of a error message.
Definition: mysql_com.h:880
static const char * sql_mode
Definition: mysqlslap.cc:197
const char * table_name
Definition: rules_table_service.cc:56
const char * db_name
Definition: rules_table_service.cc:55
ulonglong sql_mode_t
Definition: trigger.h:46
The current state of the privilege checking process for the current user, SQL statement and SQL objec...
Definition: table.h:358
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:40
Replacement of system's struct timeval to ensure we can carry 64 bit values even on a platform which ...
Definition: my_time_t.h:45
int64_t m_tv_sec
Definition: my_time_t.h:46
int64_t m_tv_usec
Definition: my_time_t.h:47
Include file for Sun RPC to compile out of the box.
This file defines all base public constants related to triggers in MySQL.
enum_trigger_event_type
Constants to enumerate possible event types on which triggers can be fired.
Definition: trigger_def.h:42
enum_trigger_action_time_type
Constants to enumerate possible timings when triggers can be fired.
Definition: trigger_def.h:52
unsigned int uint
Definition: uca9-dump.cc:75