MySQL 9.1.0
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
101 };
102
104
105 public:
106 ~Event() override = default;
107
108 public:
109 /////////////////////////////////////////////////////////////////////////
110 // schema.
111 /////////////////////////////////////////////////////////////////////////
112
113 virtual Object_id schema_id() const = 0;
115
116 /////////////////////////////////////////////////////////////////////////
117 // definer.
118 /////////////////////////////////////////////////////////////////////////
119
120 virtual const String_type &definer_user() const = 0;
121 virtual const String_type &definer_host() const = 0;
122 virtual void set_definer(const String_type &username,
123 const String_type &hostname) = 0;
124
125 /////////////////////////////////////////////////////////////////////////
126 // time_zone.
127 /////////////////////////////////////////////////////////////////////////
128
129 virtual const String_type &time_zone() const = 0;
130 virtual void set_time_zone(const String_type &time_zone) = 0;
131
132 /////////////////////////////////////////////////////////////////////////
133 // definition/utf8.
134 /////////////////////////////////////////////////////////////////////////
135
136 virtual const String_type &definition() const = 0;
137 virtual void set_definition(const String_type &definition) = 0;
138
139 virtual const String_type &definition_utf8() const = 0;
141
142 /////////////////////////////////////////////////////////////////////////
143 // execute_at.
144 /////////////////////////////////////////////////////////////////////////
145
146 virtual my_time_t execute_at() const = 0;
148
149 virtual void set_execute_at_null(bool is_null) = 0;
150 virtual bool is_execute_at_null() const = 0;
151
152 /////////////////////////////////////////////////////////////////////////
153 // interval_value.
154 /////////////////////////////////////////////////////////////////////////
155
156 virtual uint interval_value() const = 0;
157 virtual void set_interval_value(uint interval_value) = 0;
158
159 virtual void set_interval_value_null(bool is_null) = 0;
160 virtual bool is_interval_value_null() const = 0;
161
162 /////////////////////////////////////////////////////////////////////////
163 // interval_field.
164 /////////////////////////////////////////////////////////////////////////
165
168
169 virtual void set_interval_field_null(bool is_null) = 0;
170 virtual bool is_interval_field_null() const = 0;
171
172 /////////////////////////////////////////////////////////////////////////
173 // sql_mode
174 /////////////////////////////////////////////////////////////////////////
175
176 virtual ulonglong sql_mode() const = 0;
177 virtual void set_sql_mode(ulonglong sm) = 0;
178
179 /////////////////////////////////////////////////////////////////////////
180 // starts.
181 /////////////////////////////////////////////////////////////////////////
182
183 virtual my_time_t starts() const = 0;
184 virtual void set_starts(my_time_t starts) = 0;
185
186 virtual void set_starts_null(bool is_null) = 0;
187 virtual bool is_starts_null() const = 0;
188
189 /////////////////////////////////////////////////////////////////////////
190 // ends.
191 /////////////////////////////////////////////////////////////////////////
192
193 virtual my_time_t ends() const = 0;
194 virtual void set_ends(my_time_t ends) = 0;
195
196 virtual void set_ends_null(bool is_null) = 0;
197 virtual bool is_ends_null() const = 0;
198
199 /////////////////////////////////////////////////////////////////////////
200 // event_status.
201 /////////////////////////////////////////////////////////////////////////
202
203 virtual enum_event_status event_status() const = 0;
205
206 virtual void set_event_status_null(bool is_null) = 0;
207 virtual bool is_event_status_null() const = 0;
208
209 /////////////////////////////////////////////////////////////////////////
210 // on_completion.
211 /////////////////////////////////////////////////////////////////////////
212
215
216 /////////////////////////////////////////////////////////////////////////
217 // created.
218 /////////////////////////////////////////////////////////////////////////
219
220 virtual ulonglong created(bool convert_time) const = 0;
221 virtual void set_created(ulonglong created) = 0;
222
223 /////////////////////////////////////////////////////////////////////////
224 // last altered.
225 /////////////////////////////////////////////////////////////////////////
226
227 virtual ulonglong last_altered(bool convert_time) const = 0;
229
230 /////////////////////////////////////////////////////////////////////////
231 // last_executed.
232 /////////////////////////////////////////////////////////////////////////
233
234 virtual my_time_t last_executed() const = 0;
236
237 virtual void set_last_executed_null(bool is_null) = 0;
238 virtual bool is_last_executed_null() const = 0;
239
240 /////////////////////////////////////////////////////////////////////////
241 // comment.
242 /////////////////////////////////////////////////////////////////////////
243
244 virtual const String_type &comment() const = 0;
245 virtual void set_comment(const String_type &comment) = 0;
246
247 /////////////////////////////////////////////////////////////////////////
248 // originator.
249 /////////////////////////////////////////////////////////////////////////
250
251 virtual ulonglong originator() const = 0;
253
254 /////////////////////////////////////////////////////////////////////////
255 // collations.
256 /////////////////////////////////////////////////////////////////////////
257
258 virtual Object_id client_collation_id() const = 0;
260
264
265 virtual Object_id schema_collation_id() const = 0;
267
268 /**
269 Allocate a new object graph and invoke the copy constructor for
270 each object. Only used in unit testing.
271
272 @return pointer to dynamically allocated copy
273 */
274 virtual Event *clone() const = 0;
275
276 /**
277 Allocate a new object which can serve as a placeholder for the original
278 object in the Dictionary_client's dropped registry. Such object has the
279 same keys as the original but has no other info and as result occupies
280 less memory.
281 */
283
284 static void create_mdl_key(const String_type &schema_name,
285 const String_type &name, MDL_key *key);
286};
287
288///////////////////////////////////////////////////////////////////////////
289
290} // namespace dd
291
292#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:99
@ ES_REPLICA_SIDE_DISABLED
Definition: event.h:100
@ ES_ENABLED
Definition: event.h:98
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
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
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_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:103
@ OC_DROP
Definition: event.h:103
@ OC_PRESERVE
Definition: event.h:103
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:46
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:366