MySQL  8.0.17
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, 2018, Oracle and/or its affiliates. All rights reserved.
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 
41 class String;
42 class THD;
43 class Time_zone;
44 
45 typedef ulonglong sql_mode_t;
46 namespace dd {
47 class Event;
48 }
49 
50 void init_scheduler_psi_keys(void);
51 
53  public:
56 
58 
61  bool dropped;
62  THD *thd;
63 
65 
66  /* Prevent use of these */
68  void operator=(Event_queue_element_for_exec &) = delete;
69 
70 #ifdef HAVE_PSI_INTERFACE
72 
74 #endif
75 };
76 
77 class Event_basic {
78  protected:
80 
81  public:
85 
87  Event_basic();
88  virtual ~Event_basic();
89  virtual bool fill_event_info(THD *thd, const dd::Event &ev_obj,
90  const char *dbname) = 0;
91 };
92 
94  public:
96  int m_status;
98 
106 
109 
110  bool m_dropped;
111 
113 
115  virtual ~Event_queue_element();
116  virtual bool fill_event_info(THD *thd, const dd::Event &event,
117  const char *dbname);
118 
119  bool compute_next_execution_time(THD *thd);
120 
121  void mark_last_executed(THD *thd);
122 };
123 
125  public:
127 
130 
132 
135 
137 
140  Event_timed();
141  virtual ~Event_timed();
142 
143  void init();
144 
145  virtual bool fill_event_info(THD *thd, const dd::Event &event,
146  const char *schema_name);
147 
148  int get_create_event(const THD *thd, String *buf);
149 
150  Event_timed(const Event_timed &) = delete;
151  void operator=(Event_timed &) = delete;
152 };
153 
154 class Event_job_data : public Event_basic {
155  public:
159 
161 
163 
164  Event_job_data();
165 
166  bool execute(THD *thd, bool drop);
167 
168  Event_job_data(const Event_job_data &) = delete;
169  void operator=(Event_job_data &) = delete;
170 
171  private:
172  virtual bool fill_event_info(THD *thd, const dd::Event &event,
173  const char *schema_name);
174  bool construct_sp_sql(THD *thd, String *sp_sql);
175 };
176 
177 /**
178  Build an SQL drop event string.
179 
180  @param[in] thd Thread handle
181  @param[in,out] sp_sql Pointer to String object where the SQL query will
182  be stored
183  @param[in] db_name The schema name
184  @param[in] event_name The event name
185 
186  @retval false The drop event SQL query is built
187  @retval true Otherwise
188 */
189 bool construct_drop_event_sql(THD *thd, String *sp_sql,
190  const LEX_STRING &db_name,
191  const LEX_STRING &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_ */
LEX_CSTRING m_definer_host
Definition: event_data_objects.h:158
unsigned long long int ulonglong
Definition: my_inttypes.h:74
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:976
sql_mode_t m_sql_mode
Definition: event_data_objects.h:136
int m_status
Definition: event_data_objects.h:96
void operator=(Event_job_data &)=delete
const char * db_name
Definition: rules_table_service.cc:54
Definition: mysql_lex_string.h:34
void operator=(Event_timed &)=delete
ulonglong m_modified
Definition: event_data_objects.h:134
const char * event_name[]
Definition: test_pfs_resource_group.cc:71
Definition: event_data_objects.h:154
interval_type m_interval
Definition: event_data_objects.h:108
const string name("\ame\)
my_time_t m_ends
Definition: event_data_objects.h:102
Some integer typedefs for easier portability.
static PSI_statement_info psi_info
Definition: event_data_objects.h:73
virtual bool fill_event_info(THD *thd, const dd::Event &event, const char *schema_name)
Definition: event_data_objects.cc:331
Definition: event_data_objects.h:52
longlong m_expression
Definition: event_data_objects.h:107
class Stored_program_creation_ctx * m_creation_ctx
Definition: event_data_objects.h:138
Definition: mysql_lex_string.h:39
virtual bool fill_event_info(THD *thd, const dd::Event &event, const char *schema_name)
Definition: event_data_objects.cc:418
Definition: event.h:47
void mark_last_executed(THD *thd)
Set last execution time.
Definition: event_data_objects.cc:881
void init_scheduler_psi_keys()
Definition: event_data_objects.cc:82
bool m_ends_null
Definition: event_data_objects.h:104
int m_on_completion
Definition: event_data_objects.h:95
LEX_CSTRING m_definer_host
Definition: event_data_objects.h:129
[] long int my_time_t
Portable time_t replacement.
bool event_basic_db_equal(LEX_STRING db, Event_basic *et)
Definition: event_data_objects.cc:1253
LEX_CSTRING m_definer_user
Definition: event_data_objects.h:128
bool construct_drop_event_sql(THD *thd, String *sp_sql, const LEX_STRING &schema_name, const LEX_STRING &event_name)
Get DROP EVENT statement to binlog the drop of ON COMPLETION NOT PRESERVE event.
Definition: event_data_objects.cc:1214
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:51
LEX_STRING dbname
Definition: event_data_objects.h:59
Event_job_data()
Definition: event_data_objects.cc:309
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:159
Event_queue_element()
Definition: event_data_objects.cc:258
LEX_STRING m_definition
Definition: event_data_objects.h:156
Definition: event_data_objects.h:77
my_time_t m_starts
Definition: event_data_objects.h:101
ulonglong sql_mode_t
Definition: event_data_objects.h:43
Event_queue_element_for_exec()
Definition: event_data_objects.h:54
int get_create_event(const THD *thd, String *buf)
Get SHOW CREATE EVENT as string.
Definition: event_data_objects.cc:915
PSI_statement_info * get_psi_info()
Definition: event_data_objects.h:71
interval_type
Available interval types used in any statement.
Definition: my_time.h:384
bool compute_next_execution_time(THD *thd)
Definition: event_data_objects.cc:687
LEX_STRING m_comment
Definition: event_data_objects.h:131
LEX_STRING m_schema_name
Definition: event_data_objects.h:82
virtual bool fill_event_info(THD *thd, const dd::Event &ev_obj, const char *dbname)=0
bool dropped
Definition: event_data_objects.h:61
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Statement instrument information.
Definition: psi_statement_bits.h:108
unsigned int uint
Definition: uca-dump.cc:29
long long int longlong
Definition: my_inttypes.h:73
Performance schema instrumentation interface.
Definition: event_data_objects.h:93
MEM_ROOT mem_root
Definition: event_data_objects.h:79
bool m_execute_at_null
Definition: event_data_objects.h:105
virtual ~Event_timed()
Definition: event_data_objects.cc:300
virtual ~Event_queue_element()
Definition: event_data_objects.cc:278
Time_zone * m_time_zone
Definition: event_data_objects.h:86
Event_basic()
Definition: event_data_objects.cc:230
~Event_queue_element_for_exec()
Definition: event_data_objects.cc:218
my_time_t m_last_executed
Definition: event_data_objects.h:99
Definition: event_data_objects.h:124
LEX_STRING name
Definition: event_data_objects.h:60
bool execute(THD *thd, bool drop)
Compiles and executes the event (the underlying sp_head object)
Definition: event_data_objects.cc:1022
sql_mode_t m_sql_mode
Definition: event_data_objects.h:160
class Stored_program_creation_ctx * m_creation_ctx
Definition: event_data_objects.h:162
bool drop(THD *thd, const Table *tp)
Remove SDI for a table.
Definition: sdi.cc:578
longlong m_originator
Definition: event_data_objects.h:97
virtual ~Event_basic()
Definition: event_data_objects.cc:245
my_time_t m_execute_at
Definition: event_data_objects.h:100
LEX_STRING m_definer
Definition: event_data_objects.h:84
ulonglong sql_mode_t
Definition: dd_event.h:36
bool event_basic_identifier_equal(LEX_STRING db, LEX_STRING name, Event_basic *b)
Definition: event_data_objects.cc:1271
bool m_dropped
Definition: event_data_objects.h:110
uint m_execution_count
Definition: event_data_objects.h:112
void operator=(Event_queue_element_for_exec &)=delete
bool init(LEX_STRING dbname, LEX_STRING name)
Definition: event_data_objects.cc:193
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
Interface for low level time utilities.
ulonglong m_created
Definition: event_data_objects.h:133
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
LEX_STRING m_definition
Definition: event_data_objects.h:126
Stored_program_creation_ctx – base class for creation context of stored programs (stored routines...
Definition: sp_head.h:88
LEX_CSTRING m_definer_user
Definition: event_data_objects.h:157
virtual bool fill_event_info(THD *thd, const dd::Event &event, const char *dbname)
Definition: event_data_objects.cc:362
LEX_STRING m_definition_utf8
Definition: event_data_objects.h:139
Event_timed()
Definition: event_data_objects.cc:287
LEX_STRING m_event_name
Definition: event_data_objects.h:83
THD * thd
Definition: event_data_objects.h:62
bool m_starts_null
Definition: event_data_objects.h:103
void init()
Definition: event_data_objects.cc:318
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
void claim_memory_ownership()
Definition: event_data_objects.cc:206
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777