MySQL 8.1.0
Source Code Documentation
event_data_objects.h
Go to the documentation of this file.
1#ifndef _EVENT_DATA_OBJECTS_H_
2#define _EVENT_DATA_OBJECTS_H_
3/* Copyright (c) 2004, 2023, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24
25/**
26 @addtogroup Event_Scheduler
27 @{
28
29 @file event_data_objects.h
30*/
31
32#include <sys/types.h>
33
34#include "lex_string.h"
35#include "my_alloc.h" // MEM_ROOT
36#include "my_inttypes.h"
37#include "my_psi_config.h"
38#include "my_time.h" // interval_type
40#include "sql/psi_memory_key.h"
41
42class String;
43class THD;
44class Time_zone;
45
47namespace dd {
48class Event;
49}
50
52
54 public:
57
59
62 bool dropped;
64
65 void claim_memory_ownership(bool claim);
66
67 /* Prevent use of these */
70
71#ifdef HAVE_PSI_INTERFACE
73
75#endif
76};
77
79 protected:
81
82 public:
86
89 virtual ~Event_basic();
90 virtual bool fill_event_info(THD *thd, const dd::Event &ev_obj,
91 const char *dbname) = 0;
92};
93
95 public:
99
107
110
112
114
117 bool fill_event_info(THD *thd, const dd::Event &event,
118 const char *dbname) override;
119
121
122 void mark_last_executed(THD *thd);
123};
124
126 public:
128
131
133
136
138
141 Event_timed();
142 ~Event_timed() override;
143
144 void init();
145
146 bool fill_event_info(THD *thd, const dd::Event &event,
147 const char *schema_name) override;
148
149 int get_create_event(const THD *thd, String *buf);
150
151 Event_timed(const Event_timed &) = delete;
152 void operator=(Event_timed &) = delete;
153};
154
156 public:
160
162
164
166
167 bool execute(THD *thd, bool drop);
168
170 void operator=(Event_job_data &) = delete;
171
172 private:
173 bool fill_event_info(THD *thd, const dd::Event &event,
174 const char *schema_name) override;
175 bool construct_sp_sql(THD *thd, String *sp_sql);
176};
177
178/**
179 Build an SQL drop event string.
180
181 @param[in] thd Thread handle
182 @param[in,out] sp_sql Pointer to String object where the SQL query will
183 be stored
184 @param[in] db_name The schema name
185 @param[in] event_name The event name
186
187 @retval false The drop event SQL query is built
188 @retval true Otherwise
189*/
191 LEX_CSTRING event_name);
192
193/* Compares only the schema part of the identifier */
195
196/* Compares the whole identifier*/
198 Event_basic *b);
199
200/**
201 @} (End of group Event_Scheduler)
202*/
203
204#endif /* _EVENT_DATA_OBJECTS_H_ */
Definition: event_data_objects.h:78
LEX_CSTRING m_event_name
Definition: event_data_objects.h:84
Time_zone * m_time_zone
Definition: event_data_objects.h:87
MEM_ROOT mem_root
Definition: event_data_objects.h:80
LEX_CSTRING m_definer
Definition: event_data_objects.h:85
virtual bool fill_event_info(THD *thd, const dd::Event &ev_obj, const char *dbname)=0
LEX_CSTRING m_schema_name
Definition: event_data_objects.h:83
Definition: event_data_objects.h:155
sql_mode_t m_sql_mode
Definition: event_data_objects.h:161
Event_job_data(const Event_job_data &)=delete
LEX_CSTRING m_definer_host
Definition: event_data_objects.h:159
class Stored_program_creation_ctx * m_creation_ctx
Definition: event_data_objects.h:163
void operator=(Event_job_data &)=delete
LEX_STRING m_definition
Definition: event_data_objects.h:157
LEX_CSTRING m_definer_user
Definition: event_data_objects.h:158
Definition: event_data_objects.h:53
LEX_CSTRING dbname
Definition: event_data_objects.h:60
Event_queue_element_for_exec(const Event_queue_element_for_exec &)=delete
THD * thd
Definition: event_data_objects.h:63
LEX_CSTRING name
Definition: event_data_objects.h:61
void operator=(Event_queue_element_for_exec &)=delete
PSI_statement_info * get_psi_info()
Definition: event_data_objects.h:72
bool dropped
Definition: event_data_objects.h:62
Definition: event_data_objects.h:94
bool m_starts_null
Definition: event_data_objects.h:104
my_time_t m_ends
Definition: event_data_objects.h:103
longlong m_originator
Definition: event_data_objects.h:98
my_time_t m_execute_at
Definition: event_data_objects.h:101
uint m_execution_count
Definition: event_data_objects.h:113
bool m_execute_at_null
Definition: event_data_objects.h:106
my_time_t m_last_executed
Definition: event_data_objects.h:100
my_time_t m_starts
Definition: event_data_objects.h:102
int m_on_completion
Definition: event_data_objects.h:96
bool m_ends_null
Definition: event_data_objects.h:105
int m_status
Definition: event_data_objects.h:97
interval_type m_interval
Definition: event_data_objects.h:109
longlong m_expression
Definition: event_data_objects.h:108
bool m_dropped
Definition: event_data_objects.h:111
Definition: event_data_objects.h:125
sql_mode_t m_sql_mode
Definition: event_data_objects.h:137
ulonglong m_modified
Definition: event_data_objects.h:135
LEX_CSTRING m_definer_host
Definition: event_data_objects.h:130
LEX_STRING m_definition
Definition: event_data_objects.h:127
class Stored_program_creation_ctx * m_creation_ctx
Definition: event_data_objects.h:139
void operator=(Event_timed &)=delete
ulonglong m_created
Definition: event_data_objects.h:134
LEX_STRING m_definition_utf8
Definition: event_data_objects.h:140
Event_timed(const Event_timed &)=delete
LEX_CSTRING m_definer_user
Definition: event_data_objects.h:129
LEX_STRING m_comment
Definition: event_data_objects.h:132
libevent global state management
Definition: http_common.h:59
Stored_program_creation_ctx – base class for creation context of stored programs (stored routines,...
Definition: sp_head.h:91
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:48
Definition: event.h:47
ulonglong sql_mode_t
Definition: dd_event.h:36
bool event_basic_identifier_equal(LEX_CSTRING db, LEX_CSTRING name, Event_basic *b)
Definition: event_data_objects.cc:1284
void init()
Definition: event_data_objects.cc:302
ulonglong sql_mode_t
Definition: event_data_objects.h:44
Event_queue_element()
Definition: event_data_objects.cc:243
bool event_basic_db_equal(LEX_CSTRING db, Event_basic *et)
Definition: event_data_objects.cc:1266
bool compute_next_execution_time(THD *thd)
Definition: event_data_objects.cc:669
bool construct_drop_event_sql(THD *thd, String *sp_sql, LEX_CSTRING schema_name, LEX_CSTRING event_name)
Get DROP EVENT statement to binlog the drop of ON COMPLETION NOT PRESERVE event.
Definition: event_data_objects.cc:1228
void init_scheduler_psi_keys()
Definition: event_data_objects.cc:82
~Event_timed() override
static PSI_statement_info psi_info
Definition: event_data_objects.h:74
bool fill_event_info(THD *thd, const dd::Event &event, const char *schema_name) override
Definition: event_data_objects.cc:400
~Event_queue_element_for_exec()
Definition: event_data_objects.cc:210
Event_job_data()
Definition: event_data_objects.cc:293
void claim_memory_ownership(bool claim)
Definition: event_data_objects.cc:198
bool init(LEX_CSTRING dbname, LEX_CSTRING name)
Definition: event_data_objects.cc:185
void mark_last_executed(THD *thd)
Set last execution time.
Definition: event_data_objects.cc:863
Event_timed()
Definition: event_data_objects.cc:272
bool construct_sp_sql(THD *thd, String *sp_sql)
Get an artificial stored procedure to parse as an event definition.
Definition: event_data_objects.cc:958
bool fill_event_info(THD *thd, const dd::Event &event, const char *dbname) override
Definition: event_data_objects.cc:345
~Event_queue_element() override
virtual ~Event_basic()
Definition: event_data_objects.cc:234
bool fill_event_info(THD *thd, const dd::Event &event, const char *schema_name) override
Definition: event_data_objects.cc:314
Event_basic()
Definition: event_data_objects.cc:222
bool execute(THD *thd, bool drop)
Compiles and executes the event (the underlying sp_head object)
Definition: event_data_objects.cc:1004
int get_create_event(const THD *thd, String *buf)
Get SHOW CREATE EVENT as string.
Definition: event_data_objects.cc:897
PSI_memory_key key_memory_event_basic_root
Definition: events.cc:1041
bool drop(THD *thd, const Table *tp)
Remove SDI for a table.
Definition: sdi.cc:638
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
long long int longlong
Definition: my_inttypes.h:54
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Interface for low level time utilities.
interval_type
Available interval types used in any statement.
Definition: my_time.h:454
int64_t my_time_t
Portable time_t replacement.
Definition: my_time_t.h:31
Definition: buf0block_hint.cc:29
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
const char * db_name
Definition: rules_table_service.cc:54
Performance schema instrumentation interface.
required string event
Definition: replication_group_member_actions.proto:31
case opt name
Definition: sslopt-case.h:32
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: mysql_lex_string.h:39
Definition: mysql_lex_string.h:34
Statement instrument information.
Definition: psi_statement_bits.h:132