MySQL  8.0.18
Source Code Documentation
dd_event.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
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_INCLUDED
24 #define DD_EVENT_INCLUDED
25 
26 #include "my_inttypes.h"
27 #include "my_time.h" // interval_type
28 #include "sql/dd/string_type.h" // dd::String_type
29 #include "sql/dd/types/event.h" // dd::Event::enum_event_status
30 
31 class Event_parse_data;
32 class THD;
33 
34 struct LEX_USER;
35 
37 
38 namespace dd {
39 class Schema;
40 
41 /**
42  Convert new DD Event::enum_event_status to status type used in
43  server code.
44 
45  @param event_status status of type enum_event_status.
46 
47  @returns an int indicating status of event used in server code.
48 */
50 
51 /**
52  Convert new DD Event::enum_on_completion to completion type used in
53  server code.
54 
55  @param on_completion on_completion of type enum_on_completion.
56 
57  @returns an int indicating on_completion of event used in server code.
58 */
60 
61 /**
62  Convert new DD interval_field type to type interval_type used in
63  server code.
64 
65  @param interval_field interval_field of type enum_interval_field.
66 
67  @returns an value of type interval type indicating interval type values
68  used in server code.
69 */
71 
72 /**
73  Create an event object and commit it to DD Table Events.
74 
75  @param thd Thread handle
76  @param schema Schema object.
77  @param event_name Event name
78  @param event_body Event body.
79  @param event_body_utf8 Event body in utf8 format.
80  @param definer Definer of the event.
81  @param event_data Event information obtained from parser.
82 
83  @retval true Event creation failed.
84  @retval false Event creation succeeded.
85 */
86 bool create_event(THD *thd, const Schema &schema, const String_type &event_name,
87  const String_type &event_body,
88  const String_type &event_body_utf8, const LEX_USER *definer,
89  Event_parse_data *event_data);
90 
91 /**
92  Create or update a event object and commit it to
93  DD Table Events.
94 
95  @param thd Thread handle
96  @param event Event to update.
97  @param schema Schema currently containing the event.
98  @param new_schema New Schema or nullptr if the schema does not
99  change.
100  @param new_event_name Updated Event name.
101  @param new_event_body Updated Event body.
102  @param new_event_body_utf8 Updated Event body in utf8 format.
103  @param definer Definer of the event.
104  @param event_data Event information obtained from parser.
105 
106  @retval true Event updation failed.
107  @retval false Event updation succeeded.
108 */
109 bool update_event(THD *thd, Event *event, const dd::Schema &schema,
110  const dd::Schema *new_schema,
111  const String_type &new_event_name,
112  const String_type &new_event_body,
113  const String_type &new_event_body_utf8,
114  const LEX_USER *definer, Event_parse_data *event_data);
115 
116 /**
117  Update time related fields of Event object.
118 
119  @param thd Thread handle
120  @param event Event to update.
121  @param last_executed Time the event was last executed.
122  @param status Event status.
123 
124  @retval true true if update failed.
125  @retval false false if update succeeded.
126 */
127 bool update_event_time_and_status(THD *thd, Event *event,
128  my_time_t last_executed, ulonglong status);
129 
130 } // namespace dd
131 #endif // DD_EVENT_INCLUDED
unsigned long long int ulonglong
Definition: my_inttypes.h:55
const char * event_name[]
Definition: test_pfs_resource_group.cc:71
Some integer typedefs for easier portability.
interval_type get_old_interval_type(Event::enum_interval_field interval_field)
Convert new DD interval_field type to type interval_type used in server code.
Definition: dd_event.cc:137
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
[] long int my_time_t
Portable time_t replacement.
enum_event_status
Definition: event.h:96
Definition: table.h:2367
interval_type
Available interval types used in any statement.
Definition: my_time.h:384
Definition: event_parse_data.h:43
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 an event object and commit it to DD Table Events.
Definition: dd_event.cc:345
int get_old_on_completion(Event::enum_on_completion on_completion)
Convert new DD Event::enum_on_completion to completion type used in server code.
Definition: dd_event.cc:95
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)
Create or update a event object and commit it to DD Table Events.
Definition: dd_event.cc:360
ulonglong sql_mode_t
Definition: dd_event.h:36
Definition: schema.h:61
enum_interval_field
Definition: event.h:73
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
static STATUS status
Definition: mysql.cc:193
Interface for low level time utilities.
bool update_event_time_and_status(THD *thd, Event *event, my_time_t last_executed, ulonglong status)
Update time related fields of Event object.
Definition: dd_event.cc:384
int get_old_status(Event::enum_event_status event_status)
Convert new DD Event::enum_event_status to status type used in server code.
Definition: dd_event.cc:50
enum_on_completion
Definition: event.h:98
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:778