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