MySQL 8.1.0
Source Code Documentation
event.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2023, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef DD__EVENT_INCLUDED
24#define DD__EVENT_INCLUDED
25
26#include "my_inttypes.h"
27#include "my_time_t.h" // my_time_t
28#include "sql/dd/impl/raw/object_keys.h" // IWYU pragma: keep
29#include "sql/dd/types/entity_object.h" // dd::Entity_object
30
31struct MDL_key;
32
33namespace dd {
34
35///////////////////////////////////////////////////////////////////////////
36
37class Event_impl;
38class Void_key;
39class Item_name_key;
40
41namespace tables {
42class Events;
43}
44
45///////////////////////////////////////////////////////////////////////////
46
47class Event : virtual public Entity_object {
48 public:
55
56 // We need a set of functions to update a preallocated key.
57 virtual bool update_id_key(Id_key *key) const {
58 return update_id_key(key, id());
59 }
60
61 static bool update_id_key(Id_key *key, Object_id id);
62
63 virtual bool update_name_key(Name_key *key) const {
64 return update_name_key(key, schema_id(), name());
65 }
66
68 const String_type &name);
69
70 virtual bool update_aux_key(Aux_key *) const { return true; }
71
72 public:
94 };
95
97
99
100 public:
101 ~Event() override = default;
102
103 public:
104 /////////////////////////////////////////////////////////////////////////
105 // schema.
106 /////////////////////////////////////////////////////////////////////////
107
108 virtual Object_id schema_id() const = 0;
110
111 /////////////////////////////////////////////////////////////////////////
112 // definer.
113 /////////////////////////////////////////////////////////////////////////
114
115 virtual const String_type &definer_user() const = 0;
116 virtual const String_type &definer_host() const = 0;
117 virtual void set_definer(const String_type &username,
118 const String_type &hostname) = 0;
119
120 /////////////////////////////////////////////////////////////////////////
121 // time_zone.
122 /////////////////////////////////////////////////////////////////////////
123
124 virtual const String_type &time_zone() const = 0;
125 virtual void set_time_zone(const String_type &time_zone) = 0;
126
127 /////////////////////////////////////////////////////////////////////////
128 // definition/utf8.
129 /////////////////////////////////////////////////////////////////////////
130
131 virtual const String_type &definition() const = 0;
132 virtual void set_definition(const String_type &definition) = 0;
133
134 virtual const String_type &definition_utf8() const = 0;
136
137 /////////////////////////////////////////////////////////////////////////
138 // execute_at.
139 /////////////////////////////////////////////////////////////////////////
140
141 virtual my_time_t execute_at() const = 0;
143
144 virtual void set_execute_at_null(bool is_null) = 0;
145 virtual bool is_execute_at_null() const = 0;
146
147 /////////////////////////////////////////////////////////////////////////
148 // interval_value.
149 /////////////////////////////////////////////////////////////////////////
150
151 virtual uint interval_value() const = 0;
152 virtual void set_interval_value(uint interval_value) = 0;
153
154 virtual void set_interval_value_null(bool is_null) = 0;
155 virtual bool is_interval_value_null() const = 0;
156
157 /////////////////////////////////////////////////////////////////////////
158 // interval_field.
159 /////////////////////////////////////////////////////////////////////////
160
163
164 virtual void set_interval_field_null(bool is_null) = 0;
165 virtual bool is_interval_field_null() const = 0;
166
167 /////////////////////////////////////////////////////////////////////////
168 // sql_mode
169 /////////////////////////////////////////////////////////////////////////
170
171 virtual ulonglong sql_mode() const = 0;
172 virtual void set_sql_mode(ulonglong sm) = 0;
173
174 /////////////////////////////////////////////////////////////////////////
175 // starts.
176 /////////////////////////////////////////////////////////////////////////
177
178 virtual my_time_t starts() const = 0;
179 virtual void set_starts(my_time_t starts) = 0;
180
181 virtual void set_starts_null(bool is_null) = 0;
182 virtual bool is_starts_null() const = 0;
183
184 /////////////////////////////////////////////////////////////////////////
185 // ends.
186 /////////////////////////////////////////////////////////////////////////
187
188 virtual my_time_t ends() const = 0;
189 virtual void set_ends(my_time_t ends) = 0;
190
191 virtual void set_ends_null(bool is_null) = 0;
192 virtual bool is_ends_null() const = 0;
193
194 /////////////////////////////////////////////////////////////////////////
195 // event_status.
196 /////////////////////////////////////////////////////////////////////////
197
198 virtual enum_event_status event_status() const = 0;
200
201 virtual void set_event_status_null(bool is_null) = 0;
202 virtual bool is_event_status_null() const = 0;
203
204 /////////////////////////////////////////////////////////////////////////
205 // on_completion.
206 /////////////////////////////////////////////////////////////////////////
207
210
211 /////////////////////////////////////////////////////////////////////////
212 // created.
213 /////////////////////////////////////////////////////////////////////////
214
215 virtual ulonglong created(bool convert_time) const = 0;
216 virtual void set_created(ulonglong created) = 0;
217
218 /////////////////////////////////////////////////////////////////////////
219 // last altered.
220 /////////////////////////////////////////////////////////////////////////
221
222 virtual ulonglong last_altered(bool convert_time) const = 0;
224
225 /////////////////////////////////////////////////////////////////////////
226 // last_executed.
227 /////////////////////////////////////////////////////////////////////////
228
229 virtual my_time_t last_executed() const = 0;
231
232 virtual void set_last_executed_null(bool is_null) = 0;
233 virtual bool is_last_executed_null() const = 0;
234
235 /////////////////////////////////////////////////////////////////////////
236 // comment.
237 /////////////////////////////////////////////////////////////////////////
238
239 virtual const String_type &comment() const = 0;
240 virtual void set_comment(const String_type &comment) = 0;
241
242 /////////////////////////////////////////////////////////////////////////
243 // originator.
244 /////////////////////////////////////////////////////////////////////////
245
246 virtual ulonglong originator() const = 0;
248
249 /////////////////////////////////////////////////////////////////////////
250 // collations.
251 /////////////////////////////////////////////////////////////////////////
252
253 virtual Object_id client_collation_id() const = 0;
255
259
260 virtual Object_id schema_collation_id() const = 0;
262
263 /**
264 Allocate a new object graph and invoke the copy constructor for
265 each object. Only used in unit testing.
266
267 @return pointer to dynamically allocated copy
268 */
269 virtual Event *clone() const = 0;
270
271 /**
272 Allocate a new object which can serve as a placeholder for the original
273 object in the Dictionary_client's dropped registry. Such object has the
274 same keys as the original but has no other info and as result occupies
275 less memory.
276 */
278
279 static void create_mdl_key(const String_type &schema_name,
280 const String_type &name, MDL_key *key);
281};
282
283///////////////////////////////////////////////////////////////////////////
284
285} // namespace dd
286
287#endif // DD__EVENT_INCLUDED
A facade to the functionality of the Event Scheduler.
Definition: events.h:95
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:47
virtual const String_type & name() const =0
Definition: event_impl.h:47
Definition: event.h:47
enum_event_status
Definition: event.h:96
@ ES_DISABLED
Definition: event.h:96
@ ES_ENABLED
Definition: event.h:96
@ ES_SLAVESIDE_DISABLED
Definition: event.h:96
virtual void set_definition_utf8(const String_type &definition_utf8)=0
virtual void set_comment(const String_type &comment)=0
virtual my_time_t execute_at() const =0
virtual const String_type & definition() const =0
virtual void set_connection_collation_id(Object_id connection_collation_id)=0
~Event() override=default
static void create_mdl_key(const String_type &schema_name, const String_type &name, MDL_key *key)
Definition: event_impl.cc:297
virtual void set_execute_at_null(bool is_null)=0
virtual const String_type & definer_host() const =0
virtual Event * clone_dropped_object_placeholder() const =0
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Void_key Aux_key
Definition: event.h:54
virtual bool update_aux_key(Aux_key *) const
Definition: event.h:70
tables::Events DD_table
Definition: event.h:51
virtual void set_event_status_null(bool is_null)=0
virtual bool is_execute_at_null() const =0
virtual bool is_interval_value_null() const =0
virtual bool is_starts_null() const =0
virtual bool is_ends_null() const =0
Event_impl Impl
Definition: event.h:49
virtual void set_originator(ulonglong originator)=0
virtual void set_starts_null(bool is_null)=0
virtual Event * clone() const =0
Allocate a new object graph and invoke the copy constructor for each object.
virtual const String_type & comment() const =0
virtual uint interval_value() const =0
virtual ulonglong last_altered(bool convert_time) const =0
virtual enum_on_completion on_completion() const =0
virtual bool is_event_status_null() const =0
virtual const String_type & definer_user() const =0
virtual void set_definer(const String_type &username, const String_type &hostname)=0
virtual void set_starts(my_time_t starts)=0
virtual bool is_interval_field_null() const =0
virtual void set_client_collation_id(Object_id client_collation_id)=0
virtual ulonglong originator() const =0
Item_name_key Name_key
Definition: event.h:53
virtual void set_schema_collation_id(Object_id schema_collation_id)=0
virtual void set_sql_mode(ulonglong sm)=0
virtual void set_interval_value_null(bool is_null)=0
virtual my_time_t starts() const =0
virtual void set_last_executed_null(bool is_null)=0
enum_interval_field
Definition: event.h:73
@ IF_SECOND
Definition: event.h:81
@ IF_HOUR_MINUTE
Definition: event.h:87
@ IF_HOUR_SECOND
Definition: event.h:88
@ IF_MINUTE_MICROSECOND
Definition: event.h:92
@ IF_MINUTE_SECOND
Definition: event.h:89
@ IF_QUARTER
Definition: event.h:75
@ IF_HOUR_MICROSECOND
Definition: event.h:91
@ IF_HOUR
Definition: event.h:78
@ IF_MONTH
Definition: event.h:76
@ IF_DAY_SECOND
Definition: event.h:86
@ IF_WEEK
Definition: event.h:80
@ IF_DAY_MICROSECOND
Definition: event.h:90
@ IF_YEAR
Definition: event.h:74
@ IF_DAY_HOUR
Definition: event.h:84
@ IF_MINUTE
Definition: event.h:79
@ IF_SECOND_MICROSECOND
Definition: event.h:93
@ IF_DAY_MINUTE
Definition: event.h:85
@ IF_MICROSECOND
Definition: event.h:82
@ IF_YEAR_MONTH
Definition: event.h:83
@ IF_DAY
Definition: event.h:77
virtual Object_id schema_collation_id() const =0
virtual bool update_id_key(Id_key *key) const
Definition: event.h:57
virtual void set_ends(my_time_t ends)=0
virtual const String_type & definition_utf8() const =0
virtual bool update_name_key(Name_key *key) const
Definition: event.h:63
virtual void set_last_executed(my_time_t last_executed)=0
virtual void set_created(ulonglong created)=0
virtual Object_id client_collation_id() const =0
virtual void set_schema_id(Object_id schema_id)=0
virtual enum_interval_field interval_field() const =0
virtual Object_id schema_id() const =0
virtual enum_event_status event_status() const =0
virtual ulonglong sql_mode() const =0
virtual void set_interval_field(enum_interval_field interval_field)=0
virtual void set_time_zone(const String_type &time_zone)=0
Primary_id_key Id_key
Definition: event.h:52
virtual my_time_t last_executed() const =0
enum_on_completion
Definition: event.h:98
@ OC_DROP
Definition: event.h:98
@ OC_PRESERVE
Definition: event.h:98
virtual void set_event_status(enum_event_status event_status)=0
virtual void set_ends_null(bool is_null)=0
virtual void set_execute_at(my_time_t execute_at)=0
virtual const String_type & time_zone() const =0
virtual void set_interval_field_null(bool is_null)=0
virtual void set_interval_value(uint interval_value)=0
virtual my_time_t ends() const =0
virtual void set_last_altered(ulonglong last_altered)=0
Event Cache_partition
Definition: event.h:50
virtual Object_id connection_collation_id() const =0
virtual bool is_last_executed_null() const =0
virtual ulonglong created(bool convert_time) const =0
virtual void set_definition(const String_type &definition)=0
virtual void set_on_completion(enum_on_completion on_completion)=0
Definition: object_keys.h:165
Definition: object_keys.h:76
Definition: object_keys.h:53
Definition: events.h:45
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
int64_t my_time_t
Portable time_t replacement.
Definition: my_time_t.h:31
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Metadata lock object key.
Definition: mdl.h:364