MySQL 8.4.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, 2024, 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 designed to work 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 either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26/**
27 @addtogroup Event_Scheduler
28 @{
29
30 @file event_data_objects.h
31*/
32
33#include <stdint.h>
34#include <sys/types.h>
35
36#include "lex_string.h"
37#include "my_alloc.h" // MEM_ROOT
38#include "my_inttypes.h"
39#include "my_psi_config.h"
40#include "my_time.h" // interval_type
42#include "sql/psi_memory_key.h"
43
44class String;
45class THD;
46class Time_zone;
47
48using sql_mode_t = uint64_t;
49namespace dd {
50class Event;
51}
52
54
56 public:
59
61
64 bool dropped;
66
67 void claim_memory_ownership(bool claim);
68
69 /* Prevent use of these */
72
73#ifdef HAVE_PSI_INTERFACE
75
77#endif
78};
79
81 protected:
83
84 public:
88
91 virtual ~Event_basic();
92 virtual bool fill_event_info(THD *thd, const dd::Event &ev_obj,
93 const char *dbname) = 0;
94};
95
97 public:
101
109
112
114
116
119 bool fill_event_info(THD *thd, const dd::Event &event,
120 const char *dbname) override;
121
123
124 void mark_last_executed(THD *thd);
125};
126
128 public:
130
133
135
138
140
143 Event_timed();
144 ~Event_timed() override;
145
146 void init();
147
148 bool fill_event_info(THD *thd, const dd::Event &event,
149 const char *schema_name) override;
150
151 int get_create_event(const THD *thd, String *buf);
152
153 Event_timed(const Event_timed &) = delete;
154 void operator=(Event_timed &) = delete;
155};
156
158 public:
162
164
166
168
169 bool execute(THD *thd, bool drop);
170
172 void operator=(Event_job_data &) = delete;
173
174 private:
175 bool fill_event_info(THD *thd, const dd::Event &event,
176 const char *schema_name) override;
177 bool construct_sp_sql(THD *thd, String *sp_sql);
178};
179
180/**
181 Build an SQL drop event string.
182
183 @param[in] thd Thread handle
184 @param[in,out] sp_sql Pointer to String object where the SQL query will
185 be stored
186 @param[in] db_name The schema name
187 @param[in] event_name The event name
188
189 @retval false The drop event SQL query is built
190 @retval true Otherwise
191*/
193 LEX_CSTRING event_name);
194
195/* Compares only the schema part of the identifier */
197
198/* Compares the whole identifier*/
200 Event_basic *b);
201
202/**
203 @} (End of group Event_Scheduler)
204*/
205
206#endif /* _EVENT_DATA_OBJECTS_H_ */
Definition: event_data_objects.h:80
LEX_CSTRING m_event_name
Definition: event_data_objects.h:86
Time_zone * m_time_zone
Definition: event_data_objects.h:89
MEM_ROOT mem_root
Definition: event_data_objects.h:82
LEX_CSTRING m_definer
Definition: event_data_objects.h:87
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:85
Definition: event_data_objects.h:157
sql_mode_t m_sql_mode
Definition: event_data_objects.h:163
Event_job_data(const Event_job_data &)=delete
LEX_CSTRING m_definer_host
Definition: event_data_objects.h:161
class Stored_program_creation_ctx * m_creation_ctx
Definition: event_data_objects.h:165
void operator=(Event_job_data &)=delete
LEX_STRING m_definition
Definition: event_data_objects.h:159
LEX_CSTRING m_definer_user
Definition: event_data_objects.h:160
Definition: event_data_objects.h:55
LEX_CSTRING dbname
Definition: event_data_objects.h:62
Event_queue_element_for_exec(const Event_queue_element_for_exec &)=delete
THD * thd
Definition: event_data_objects.h:65
LEX_CSTRING name
Definition: event_data_objects.h:63
void operator=(Event_queue_element_for_exec &)=delete
PSI_statement_info * get_psi_info()
Definition: event_data_objects.h:74
bool dropped
Definition: event_data_objects.h:64
Definition: event_data_objects.h:96
bool m_starts_null
Definition: event_data_objects.h:106
my_time_t m_ends
Definition: event_data_objects.h:105
longlong m_originator
Definition: event_data_objects.h:100
my_time_t m_execute_at
Definition: event_data_objects.h:103
uint m_execution_count
Definition: event_data_objects.h:115
bool m_execute_at_null
Definition: event_data_objects.h:108
my_time_t m_last_executed
Definition: event_data_objects.h:102
my_time_t m_starts
Definition: event_data_objects.h:104
int m_on_completion
Definition: event_data_objects.h:98
bool m_ends_null
Definition: event_data_objects.h:107
int m_status
Definition: event_data_objects.h:99
interval_type m_interval
Definition: event_data_objects.h:111
longlong m_expression
Definition: event_data_objects.h:110
bool m_dropped
Definition: event_data_objects.h:113
Definition: event_data_objects.h:127
sql_mode_t m_sql_mode
Definition: event_data_objects.h:139
ulonglong m_modified
Definition: event_data_objects.h:137
LEX_CSTRING m_definer_host
Definition: event_data_objects.h:132
LEX_STRING m_definition
Definition: event_data_objects.h:129
class Stored_program_creation_ctx * m_creation_ctx
Definition: event_data_objects.h:141
void operator=(Event_timed &)=delete
ulonglong m_created
Definition: event_data_objects.h:136
LEX_STRING m_definition_utf8
Definition: event_data_objects.h:142
Event_timed(const Event_timed &)=delete
LEX_CSTRING m_definer_user
Definition: event_data_objects.h:131
LEX_STRING m_comment
Definition: event_data_objects.h:134
Stored_program_creation_ctx – base class for creation context of stored programs (stored routines,...
Definition: sp_head.h:92
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 represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:49
Definition: event.h:48
uint64_t sql_mode_t
Definition: dd_event.h:39
bool event_basic_identifier_equal(LEX_CSTRING db, LEX_CSTRING name, Event_basic *b)
Definition: event_data_objects.cc:1294
void init()
Definition: event_data_objects.cc:305
Event_queue_element()
Definition: event_data_objects.cc:246
bool event_basic_db_equal(LEX_CSTRING db, Event_basic *et)
Definition: event_data_objects.cc:1276
bool compute_next_execution_time(THD *thd)
Definition: event_data_objects.cc:672
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:1238
void init_scheduler_psi_keys()
Definition: event_data_objects.cc:85
~Event_timed() override
static PSI_statement_info psi_info
Definition: event_data_objects.h:76
bool fill_event_info(THD *thd, const dd::Event &event, const char *schema_name) override
Definition: event_data_objects.cc:403
~Event_queue_element_for_exec()
Definition: event_data_objects.cc:213
Event_job_data()
Definition: event_data_objects.cc:296
void claim_memory_ownership(bool claim)
Definition: event_data_objects.cc:201
bool init(LEX_CSTRING dbname, LEX_CSTRING name)
Definition: event_data_objects.cc:188
void mark_last_executed(THD *thd)
Set last execution time.
Definition: event_data_objects.cc:866
Event_timed()
Definition: event_data_objects.cc:275
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:968
bool fill_event_info(THD *thd, const dd::Event &event, const char *dbname) override
Definition: event_data_objects.cc:348
~Event_queue_element() override
virtual ~Event_basic()
Definition: event_data_objects.cc:237
bool fill_event_info(THD *thd, const dd::Event &event, const char *schema_name) override
Definition: event_data_objects.cc:317
Event_basic()
Definition: event_data_objects.cc:225
bool execute(THD *thd, bool drop)
Compiles and executes the event (the underlying sp_head object)
Definition: event_data_objects.cc:1014
int get_create_event(const THD *thd, String *buf)
Get SHOW CREATE EVENT as string.
Definition: event_data_objects.cc:900
PSI_memory_key key_memory_event_basic_root
Definition: events.cc:1042
bool drop(THD *thd, const Table *tp)
Remove SDI for a table.
Definition: sdi.cc:639
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:56
long long int longlong
Definition: my_inttypes.h:55
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:455
int64_t my_time_t
Portable time_t replacement.
Definition: my_time_t.h:32
Definition: buf0block_hint.cc:30
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
const char * db_name
Definition: rules_table_service.cc:55
Performance schema instrumentation interface.
required string event
Definition: replication_group_member_actions.proto:32
case opt name
Definition: sslopt-case.h:29
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
Definition: mysql_lex_string.h:35
Statement instrument information.
Definition: psi_statement_bits.h:133