MySQL 9.1.0
Source Code Documentation
Event_parse_data Class Reference

#include <event_parse_data.h>

Public Types

enum  enum_status { ENABLED = 1 , DISABLED , REPLICA_SIDE_DISABLED }
 
enum  enum_on_completion { ON_COMPLETION_DEFAULT = 0 , ON_COMPLETION_DROP , ON_COMPLETION_PRESERVE }
 

Public Member Functions

 Event_parse_data ()=default
 
 Event_parse_data (const Event_parse_data &)=delete
 
void operator= (Event_parse_data &)=delete
 
bool resolve (THD *)
 Resolves the event parse data by checking the validity of the data gathered during the parsing phase. More...
 
bool check_for_execute (THD *)
 Checks performed on every execute. More...
 
bool check_dates (THD *thd, enum_on_completion previous_on_completion)
 Check time/dates in ALTER EVENT. More...
 

Public Attributes

enum_on_completion on_completion {ON_COMPLETION_DEFAULT}
 
enum_status status {Event_parse_data::ENABLED}
 
bool status_changed {false}
 
std::uint64_t originator {0}
 
bool do_not_create {false}
 
bool body_changed {false}
 
LEX_CSTRING dbname {}
 
LEX_CSTRING name {}
 
LEX_CSTRING definer {}
 
LEX_CSTRING comment {}
 
Itemitem_starts {nullptr}
 
Itemitem_ends {nullptr}
 
Itemitem_execute_at {nullptr}
 
my_time_t starts {0}
 
my_time_t ends {0}
 
my_time_t execute_at {0}
 
bool starts_null {true}
 
bool ends_null {true}
 
bool execute_at_null {true}
 
sp_nameidentifier {nullptr}
 
Itemitem_expression {nullptr}
 
longlong expression {0}
 
interval_type interval {INTERVAL_LAST}
 
sp_headevent_body {nullptr}
 

Private Member Functions

void init_definer (THD *thd)
 Inits definer (definer_user and definer_host) during parsing. More...
 
void init_name (THD *thd, sp_name *spn)
 Set a name of the event. More...
 
bool init_execute_at (THD *thd)
 Sets time for execution for one-time event. More...
 
bool init_interval (THD *thd)
 Sets time for execution of multi-time event. More...
 
bool init_starts (THD *thd)
 Sets STARTS. More...
 
bool init_ends (THD *thd)
 Sets ENDS (deactivation time). More...
 
void report_bad_value (THD *thd, const char *item_name, Item *bad_item)
 Prints an error message about invalid value. More...
 
bool check_if_in_the_past (THD *thd, my_time_t ltime_utc)
 This function is called on CREATE EVENT or ALTER EVENT. More...
 
void check_originator_id (THD *thd)
 Set the originator id of the event to the server_id if executing on the source or set to the server_id of the source if executing on the replica. More...
 

Member Enumeration Documentation

◆ enum_on_completion

Enumerator
ON_COMPLETION_DEFAULT 
ON_COMPLETION_DROP 
ON_COMPLETION_PRESERVE 

◆ enum_status

Enumerator
ENABLED 
DISABLED 
REPLICA_SIDE_DISABLED 

Constructor & Destructor Documentation

◆ Event_parse_data() [1/2]

Event_parse_data::Event_parse_data ( )
default

◆ Event_parse_data() [2/2]

Event_parse_data::Event_parse_data ( const Event_parse_data )
delete

Member Function Documentation

◆ check_dates()

bool Event_parse_data::check_dates ( THD thd,
enum_on_completion  previous_on_completion 
)

Check time/dates in ALTER EVENT.

We check whether ALTER EVENT was given dates that are in the past. However to know how to react, we need the ON COMPLETION type. Hence, the check is deferred until we have the previous ON COMPLETION type from the event-db to fall back on if nothing was specified in the ALTER EVENT-statement.

Parameters
thdThread
previous_on_completionON COMPLETION value currently in event-db. Will be overridden by value in ALTER EVENT if given.
Returns
true on error, false otherwise

◆ check_for_execute()

bool Event_parse_data::check_for_execute ( THD thd)

Checks performed on every execute.

This includes checking and possibly initializing the definer, and checking the originator id.

Parameters
thdTHD
Returns
true on error, false otherwise.

◆ check_if_in_the_past()

bool Event_parse_data::check_if_in_the_past ( THD thd,
my_time_t  ltime_utc 
)
private

This function is called on CREATE EVENT or ALTER EVENT.

When either ENDS or AT is in the past, we are trying to create an event that will never be executed. If it has ON COMPLETION NOT PRESERVE (default), then it would normally be dropped already, so on CREATE EVENT we give a warning, and do not create anything. On ALTER EVENT we give a error, and do not change the event.

If the event has ON COMPLETION PRESERVE, then we see if the event is created or altered to the ENABLED (default) state. If so, then we give a warning, and change the state to DISABLED.

Otherwise it is a valid event in ON COMPLETION PRESERVE DISABLE state.

Parameters
thdTHD
ltime_utceither ENDS or AT time for event
Returns
true on error, false otherwise

◆ check_originator_id()

void Event_parse_data::check_originator_id ( THD thd)
private

Set the originator id of the event to the server_id if executing on the source or set to the server_id of the source if executing on the replica.

If executing on replica, also set status to REPLICA_SIDE_DISABLED.

Parameters
thdThread

◆ init_definer()

void Event_parse_data::init_definer ( THD thd)
private

Inits definer (definer_user and definer_host) during parsing.

Parameters
thdThread

◆ init_ends()

bool Event_parse_data::init_ends ( THD thd)
private

Sets ENDS (deactivation time).

Note
Note that activation time is not execution time. EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that the event will be executed every 5 minutes but this will end at the date shown above. Expressions are possible : DATE_ADD(NOW(), INTERVAL 1 DAY) – end tomorrow at same time.
Parameters
thdThread
Returns
true on error, false otherwise

◆ init_execute_at()

bool Event_parse_data::init_execute_at ( THD thd)
private

Sets time for execution for one-time event.

Parameters
thdThread
Returns
true on error, false otherwise

◆ init_interval()

bool Event_parse_data::init_interval ( THD thd)
private

Sets time for execution of multi-time event.

Parameters
thdThread
Returns
true on error, false otherwise

◆ init_name()

void Event_parse_data::init_name ( THD thd,
sp_name spn 
)
private

Set a name of the event.

Parameters
thdTHD
spnthe name extracted in the parser

◆ init_starts()

bool Event_parse_data::init_starts ( THD thd)
private

Sets STARTS.

Note
Note that activation time is not execution time. EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that the event will be executed every 5 minutes but this will start at the date shown above. Expressions are possible : DATE_ADD(NOW(), INTERVAL 1 DAY) – start tomorrow at same time.
Parameters
thdThread
Returns
true on error, false otherwise

◆ operator=()

void Event_parse_data::operator= ( Event_parse_data )
delete

◆ report_bad_value()

void Event_parse_data::report_bad_value ( THD thd,
const char *  item_name,
Item bad_item 
)
private

Prints an error message about invalid value.

Internally used during input data verification

Parameters
thdTHD object
item_nameThe name of the parameter
bad_itemThe parameter

Don't proceed to val_str() if an error has already been raised.

◆ resolve()

bool Event_parse_data::resolve ( THD thd)

Resolves the event parse data by checking the validity of the data gathered during the parsing phase.

Parameters
thdTHD
Returns
true on error, false otherwise.

Member Data Documentation

◆ body_changed

bool Event_parse_data::body_changed {false}

◆ comment

LEX_CSTRING Event_parse_data::comment {}

◆ dbname

LEX_CSTRING Event_parse_data::dbname {}

◆ definer

LEX_CSTRING Event_parse_data::definer {}

◆ do_not_create

bool Event_parse_data::do_not_create {false}

◆ ends

my_time_t Event_parse_data::ends {0}

◆ ends_null

bool Event_parse_data::ends_null {true}

◆ event_body

sp_head* Event_parse_data::event_body {nullptr}

◆ execute_at

my_time_t Event_parse_data::execute_at {0}

◆ execute_at_null

bool Event_parse_data::execute_at_null {true}

◆ expression

longlong Event_parse_data::expression {0}

◆ identifier

sp_name* Event_parse_data::identifier {nullptr}

◆ interval

interval_type Event_parse_data::interval {INTERVAL_LAST}

◆ item_ends

Item* Event_parse_data::item_ends {nullptr}

◆ item_execute_at

Item* Event_parse_data::item_execute_at {nullptr}

◆ item_expression

Item* Event_parse_data::item_expression {nullptr}

◆ item_starts

Item* Event_parse_data::item_starts {nullptr}

◆ name

LEX_CSTRING Event_parse_data::name {}

◆ on_completion

enum_on_completion Event_parse_data::on_completion {ON_COMPLETION_DEFAULT}

◆ originator

std::uint64_t Event_parse_data::originator {0}

◆ starts

my_time_t Event_parse_data::starts {0}

◆ starts_null

bool Event_parse_data::starts_null {true}

◆ status

enum_status Event_parse_data::status {Event_parse_data::ENABLED}

◆ status_changed

bool Event_parse_data::status_changed {false}

The documentation for this class was generated from the following files: