MySQL 8.0.40
Source Code Documentation
event_impl.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_IMPL_INCLUDED
25#define DD__EVENT_IMPL_INCLUDED
26
27#include <sys/types.h>
28#include <new>
29#include <string>
30
31#include "my_inttypes.h"
33#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_impl
35#include "sql/dd/object_id.h"
36#include "sql/dd/string_type.h"
37#include "sql/dd/types/event.h" // dd::Event
38#include "sql/sql_time.h" // gmt_time_to_local_time
39
40namespace dd {
41
42///////////////////////////////////////////////////////////////////////////
43
44class Open_dictionary_tables_ctx;
45class Weak_object;
46class Object_table;
47
48class Event_impl : public Entity_object_impl, public Event {
49 public:
50 Event_impl();
51 Event_impl(const Event_impl &);
52
53 ~Event_impl() override = default;
54
55 public:
56 const Object_table &object_table() const override;
57
59
60 bool validate() const override;
61
62 bool restore_attributes(const Raw_record &r) override;
63
64 bool store_attributes(Raw_record *r) override;
65
66 void debug_print(String_type &outb) const override;
67
68 public:
69 /////////////////////////////////////////////////////////////////////////
70 // schema.
71 /////////////////////////////////////////////////////////////////////////
72
73 Object_id schema_id() const override { return m_schema_id; }
74
76
77 /////////////////////////////////////////////////////////////////////////
78 // definer.
79 /////////////////////////////////////////////////////////////////////////
80
81 const String_type &definer_user() const override { return m_definer_user; }
82
83 const String_type &definer_host() const override { return m_definer_host; }
84
85 void set_definer(const String_type &username,
86 const String_type &hostname) override {
87 m_definer_user = username;
88 m_definer_host = hostname;
89 }
90
91 /////////////////////////////////////////////////////////////////////////
92 // time_zone
93 /////////////////////////////////////////////////////////////////////////
94
95 const String_type &time_zone() const override { return m_time_zone; }
96
97 void set_time_zone(const String_type &time_zone) override {
99 }
100
101 /////////////////////////////////////////////////////////////////////////
102 // definition/utf8.
103 /////////////////////////////////////////////////////////////////////////
104
105 const String_type &definition() const override { return m_definition; }
106
107 void set_definition(const String_type &definition) override {
109 }
110
111 const String_type &definition_utf8() const override {
112 return m_definition_utf8;
113 }
114
117 }
118
119 /////////////////////////////////////////////////////////////////////////
120 // execute_at.
121 /////////////////////////////////////////////////////////////////////////
122
123 my_time_t execute_at() const override { return m_execute_at; }
124
127 }
128
129 void set_execute_at_null(bool is_null) override {
130 m_is_execute_at_null = is_null;
131 }
132
133 bool is_execute_at_null() const override { return m_is_execute_at_null; }
134
135 /////////////////////////////////////////////////////////////////////////
136 // interval_value.
137 /////////////////////////////////////////////////////////////////////////
138
139 uint interval_value() const override { return m_interval_value; }
140
143 }
144
145 void set_interval_value_null(bool is_null) override {
146 m_is_interval_value_null = is_null;
147 }
148
149 bool is_interval_value_null() const override {
151 }
152
153 /////////////////////////////////////////////////////////////////////////
154 // interval_field
155 /////////////////////////////////////////////////////////////////////////
156
158 return m_interval_field;
159 }
160
163 }
164
165 void set_interval_field_null(bool is_null) override {
166 m_is_interval_field_null = is_null;
167 }
168
169 bool is_interval_field_null() const override {
171 }
172
173 /////////////////////////////////////////////////////////////////////////
174 // sql_mode
175 /////////////////////////////////////////////////////////////////////////
176
177 ulonglong sql_mode() const override { return m_sql_mode; }
178
179 void set_sql_mode(ulonglong sm) override { m_sql_mode = sm; }
180
181 /////////////////////////////////////////////////////////////////////////
182 // starts.
183 /////////////////////////////////////////////////////////////////////////
184
185 my_time_t starts() const override { return m_starts; }
186
188
189 void set_starts_null(bool is_null) override { m_is_starts_null = is_null; }
190
191 bool is_starts_null() const override { return m_is_starts_null; }
192
193 /////////////////////////////////////////////////////////////////////////
194 // ends.
195 /////////////////////////////////////////////////////////////////////////
196
197 my_time_t ends() const override { return m_ends; }
198
199 void set_ends(my_time_t ends) override { m_ends = ends; }
200
201 void set_ends_null(bool is_null) override { m_is_ends_null = is_null; }
202
203 bool is_ends_null() const override { return m_is_ends_null; }
204
205 /////////////////////////////////////////////////////////////////////////
206 // event_status
207 /////////////////////////////////////////////////////////////////////////
208
209 enum_event_status event_status() const override { return m_event_status; }
210
213 }
214
215 void set_event_status_null(bool is_null) override {
216 m_is_event_status_null = is_null;
217 }
218
219 bool is_event_status_null() const override { return m_is_event_status_null; }
220
221 /////////////////////////////////////////////////////////////////////////
222 // on_completion
223 /////////////////////////////////////////////////////////////////////////
224
226
229 }
230
231 /////////////////////////////////////////////////////////////////////////
232 // created.
233 /////////////////////////////////////////////////////////////////////////
234
235 ulonglong created(bool convert_time) const override {
236 return convert_time ? gmt_time_to_local_time(m_created) : m_created;
237 }
238
240
241 /////////////////////////////////////////////////////////////////////////
242 // last altered.
243 /////////////////////////////////////////////////////////////////////////
244
245 ulonglong last_altered(bool convert_time) const override {
246 return convert_time ? gmt_time_to_local_time(m_last_altered)
248 }
249
252 }
253
254 /////////////////////////////////////////////////////////////////////////
255 // last_executed.
256 /////////////////////////////////////////////////////////////////////////
257
258 my_time_t last_executed() const override { return m_last_executed; }
259
263 }
264
265 void set_last_executed_null(bool is_null) override {
266 m_is_last_executed_null = is_null;
267 }
268
269 bool is_last_executed_null() const override {
271 }
272
273 /////////////////////////////////////////////////////////////////////////
274 // comment.
275 /////////////////////////////////////////////////////////////////////////
276
277 const String_type &comment() const override { return m_comment; }
278
279 void set_comment(const String_type &comment) override { m_comment = comment; }
280
281 /////////////////////////////////////////////////////////////////////////
282 // originator
283 /////////////////////////////////////////////////////////////////////////
284
285 ulonglong originator() const override { return m_originator; }
286
289 }
290
291 /////////////////////////////////////////////////////////////////////////
292 // collation.
293 /////////////////////////////////////////////////////////////////////////
294
297 }
298
301 }
302
305 }
306
309 }
310
313 }
314
317 }
318
319 // Fix "inherits ... via dominance" warnings
321 const Entity_object_impl *impl() const override {
323 }
324 Object_id id() const override { return Entity_object_impl::id(); }
325 bool is_persistent() const override {
327 }
328 const String_type &name() const override {
330 }
331 void set_name(const String_type &name) override {
333 }
334
335 private:
339
345
350
358
365
366 // References.
367
372
373 Event *clone() const override { return new Event_impl(*this); }
374
376 Event_impl *placeholder = new Event_impl();
377 placeholder->set_id(id());
378 placeholder->set_schema_id(schema_id());
379 placeholder->set_name(name());
380 return placeholder;
381 }
382};
383
384///////////////////////////////////////////////////////////////////////////
385
386} // namespace dd
387
388#endif // DD__EVENT_IMPL_INCLUDED
Definition: entity_object_impl.h:44
void set_name(const String_type &name) override
Definition: entity_object_impl.h:62
void set_id(Object_id id)
Definition: entity_object_impl.h:51
Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:49
const String_type & name() const override
Definition: entity_object_impl.h:60
Entity_object_impl * impl() override
Definition: entity_object_impl.h:68
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:57
Definition: event_impl.h:48
ulonglong sql_mode() const override
Definition: event_impl.h:177
enum_event_status m_event_status
Definition: event_impl.h:337
Object_id m_client_collation_id
Definition: event_impl.h:369
Object_id connection_collation_id() const override
Definition: event_impl.h:303
Object_id schema_id() const override
Definition: event_impl.h:73
Event * clone_dropped_object_placeholder() const override
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Definition: event_impl.h:375
Entity_object_impl * impl() override
Definition: event_impl.h:320
void set_definer(const String_type &username, const String_type &hostname) override
Definition: event_impl.h:85
void set_event_status_null(bool is_null) override
Definition: event_impl.h:215
ulonglong m_originator
Definition: event_impl.h:343
my_time_t execute_at() const override
Definition: event_impl.h:123
void set_execute_at(my_time_t execute_at) override
Definition: event_impl.h:125
enum_interval_field m_interval_field
Definition: event_impl.h:336
bool store_attributes(Raw_record *r) override
Definition: event_impl.cc:161
bool restore_attributes(const Raw_record &r) override
Definition: event_impl.cc:90
void set_last_executed_null(bool is_null) override
Definition: event_impl.h:265
void set_last_altered(ulonglong last_altered) override
Definition: event_impl.h:250
my_time_t ends() const override
Definition: event_impl.h:197
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: event_impl.cc:257
Event_impl()
Definition: event_impl.cc:51
const String_type & time_zone() const override
Definition: event_impl.h:95
const String_type & definition() const override
Definition: event_impl.h:105
void set_interval_field(enum_interval_field interval_field) override
Definition: event_impl.h:161
my_time_t starts() const override
Definition: event_impl.h:185
String_type m_time_zone
Definition: event_impl.h:359
bool m_is_event_status_null
Definition: event_impl.h:356
bool m_is_interval_field_null
Definition: event_impl.h:353
void set_comment(const String_type &comment) override
Definition: event_impl.h:279
void debug_print(String_type &outb) const override
Definition: event_impl.cc:212
ulonglong originator() const override
Definition: event_impl.h:285
void set_interval_value_null(bool is_null) override
Definition: event_impl.h:145
void set_on_completion(enum_on_completion on_completion) override
Definition: event_impl.h:227
String_type m_comment
Definition: event_impl.h:364
void set_connection_collation_id(Object_id connection_collation_id) override
Definition: event_impl.h:307
uint interval_value() const override
Definition: event_impl.h:139
void set_ends_null(bool is_null) override
Definition: event_impl.h:201
void set_interval_field_null(bool is_null) override
Definition: event_impl.h:165
Event * clone() const override
Allocate a new object graph and invoke the copy constructor for each object.
Definition: event_impl.h:373
bool is_event_status_null() const override
Definition: event_impl.h:219
void set_originator(ulonglong originator) override
Definition: event_impl.h:287
void set_event_status(enum_event_status event_status) override
Definition: event_impl.h:211
void set_client_collation_id(Object_id client_collation_id) override
Definition: event_impl.h:299
uint m_interval_value
Definition: event_impl.h:344
bool m_is_execute_at_null
Definition: event_impl.h:351
const String_type & definer_user() const override
Definition: event_impl.h:81
bool m_is_ends_null
Definition: event_impl.h:355
const Entity_object_impl * impl() const override
Definition: event_impl.h:321
String_type m_definer_user
Definition: event_impl.h:362
my_time_t m_last_executed
Definition: event_impl.h:349
~Event_impl() override=default
Object_id m_schema_collation_id
Definition: event_impl.h:371
enum_event_status event_status() const override
Definition: event_impl.h:209
void set_interval_value(uint interval_value) override
Definition: event_impl.h:141
void set_last_executed(my_time_t last_executed) override
Definition: event_impl.h:260
String_type m_definer_host
Definition: event_impl.h:363
void set_created(ulonglong created) override
Definition: event_impl.h:239
enum_on_completion m_on_completion
Definition: event_impl.h:338
enum_on_completion on_completion() const override
Definition: event_impl.h:225
enum_interval_field interval_field() const override
Definition: event_impl.h:157
const Object_table & object_table() const override
Definition: event_impl.cc:251
bool m_is_interval_value_null
Definition: event_impl.h:352
bool m_is_last_executed_null
Definition: event_impl.h:357
bool is_execute_at_null() const override
Definition: event_impl.h:133
void set_time_zone(const String_type &time_zone) override
Definition: event_impl.h:97
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: event_impl.h:325
void set_starts(my_time_t starts) override
Definition: event_impl.h:187
ulonglong m_sql_mode
Definition: event_impl.h:340
void set_ends(my_time_t ends) override
Definition: event_impl.h:199
const String_type & name() const override
Definition: event_impl.h:328
my_time_t m_execute_at
Definition: event_impl.h:346
ulonglong last_altered(bool convert_time) const override
Definition: event_impl.h:245
Object_id m_connection_collation_id
Definition: event_impl.h:370
bool m_is_starts_null
Definition: event_impl.h:354
const String_type & comment() const override
Definition: event_impl.h:277
const String_type & definer_host() const override
Definition: event_impl.h:83
String_type m_definition_utf8
Definition: event_impl.h:361
void set_sql_mode(ulonglong sm) override
Definition: event_impl.h:179
bool is_last_executed_null() const override
Definition: event_impl.h:269
void set_name(const String_type &name) override
Definition: event_impl.h:331
ulonglong m_created
Definition: event_impl.h:341
my_time_t m_ends
Definition: event_impl.h:348
void set_schema_collation_id(Object_id schema_collation_id) override
Definition: event_impl.h:315
bool is_interval_field_null() const override
Definition: event_impl.h:169
bool is_interval_value_null() const override
Definition: event_impl.h:149
ulonglong created(bool convert_time) const override
Definition: event_impl.h:235
bool is_starts_null() const override
Definition: event_impl.h:191
Object_id m_schema_id
Definition: event_impl.h:368
void set_definition(const String_type &definition) override
Definition: event_impl.h:107
Object_id client_collation_id() const override
Definition: event_impl.h:295
const String_type & definition_utf8() const override
Definition: event_impl.h:111
bool is_ends_null() const override
Definition: event_impl.h:203
Object_id id() const override
The unique dictionary object id.
Definition: event_impl.h:324
void set_starts_null(bool is_null) override
Definition: event_impl.h:189
ulonglong m_last_altered
Definition: event_impl.h:342
String_type m_definition
Definition: event_impl.h:360
Object_id schema_collation_id() const override
Definition: event_impl.h:311
my_time_t last_executed() const override
Definition: event_impl.h:258
void set_definition_utf8(const String_type &definition_utf8) override
Definition: event_impl.h:115
void set_schema_id(Object_id schema_id) override
Definition: event_impl.h:75
void set_execute_at_null(bool is_null) override
Definition: event_impl.h:129
bool validate() const override
Definition: event_impl.cc:78
my_time_t m_starts
Definition: event_impl.h:347
Definition: event.h:48
enum_event_status
Definition: event.h:97
enum_interval_field
Definition: event.h:74
enum_on_completion
Definition: event.h:99
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:76
Definition: raw_record.h:46
ulonglong gmt_time_to_local_time(ulonglong gmt_time)
This function gets GMT time and adds value of time_zone to get the local time.
Definition: sql_time.cc:841
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
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
Interface for server time utilities.
unsigned int uint
Definition: uca9-dump.cc:75