-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathdd_event.h
134 lines (104 loc) · 4.69 KB
/
dd_event.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef DD_EVENT_INCLUDED
#define DD_EVENT_INCLUDED
#include <cstdint>
#include "my_inttypes.h"
#include "my_time.h" // interval_type
#include "sql/dd/string_type.h" // dd::String_type
#include "sql/dd/types/event.h" // dd::Event::enum_event_status
class Event_parse_data;
class THD;
struct LEX_USER;
using sql_mode_t = uint64_t;
namespace dd {
class Schema;
/**
Convert new DD Event::enum_event_status to status type used in
server code.
@param event_status status of type enum_event_status.
@returns an int indicating status of event used in server code.
*/
int get_old_status(Event::enum_event_status event_status);
/**
Convert new DD Event::enum_on_completion to completion type used in
server code.
@param on_completion on_completion of type enum_on_completion.
@returns an int indicating on_completion of event used in server code.
*/
int get_old_on_completion(Event::enum_on_completion on_completion);
/**
Convert new DD interval_field type to type interval_type used in
server code.
@param interval_field interval_field of type enum_interval_field.
@returns an value of type interval type indicating interval type values
used in server code.
*/
interval_type get_old_interval_type(Event::enum_interval_field interval_field);
/**
Create an event object and commit it to DD Table Events.
@param thd Thread handle
@param schema Schema object.
@param event_name Event name
@param event_body Event body.
@param event_body_utf8 Event body in utf8 format.
@param definer Definer of the event.
@param event_data Event information obtained from parser.
@retval true Event creation failed.
@retval false Event creation succeeded.
*/
bool create_event(THD *thd, const Schema &schema, const String_type &event_name,
const String_type &event_body,
const String_type &event_body_utf8, const LEX_USER *definer,
Event_parse_data *event_data);
/**
Create or update a event object and commit it to
DD Table Events.
@param thd Thread handle
@param event Event to update.
@param schema Schema currently containing the event.
@param new_schema New Schema or nullptr if the schema does not
change.
@param new_event_name Updated Event name.
@param new_event_body Updated Event body.
@param new_event_body_utf8 Updated Event body in utf8 format.
@param definer Definer of the event.
@param event_data Event information obtained from parser.
@retval true Event updation failed.
@retval false Event updation succeeded.
*/
bool update_event(THD *thd, Event *event, const dd::Schema &schema,
const dd::Schema *new_schema,
const String_type &new_event_name,
const String_type &new_event_body,
const String_type &new_event_body_utf8,
const LEX_USER *definer, Event_parse_data *event_data);
/**
Update time related fields of Event object.
@param thd Thread handle
@param event Event to update.
@param last_executed Time the event was last executed.
@param status Event status.
@retval true true if update failed.
@retval false false if update succeeded.
*/
bool update_event_time_and_status(THD *thd, Event *event,
my_time_t last_executed, ulonglong status);
} // namespace dd
#endif // DD_EVENT_INCLUDED