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