MySQL 8.0.30
Source Code Documentation
dd_event.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_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
32class THD;
33
34struct LEX_USER;
35
37
38namespace dd {
39class 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*/
86bool 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*/
109bool 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*/
128 my_time_t last_executed, ulonglong status);
129
130} // namespace dd
131#endif // DD_EVENT_INCLUDED
Definition: event_parse_data.h:43
libevent global state managment
Definition: http_common.h:59
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:922
enum_event_status
Definition: event.h:96
enum_interval_field
Definition: event.h:73
enum_on_completion
Definition: event.h:98
Definition: schema.h:62
ulonglong sql_mode_t
Definition: dd_event.h:36
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Interface for low level time utilities.
interval_type
Available interval types used in any statement.
Definition: my_time.h:452
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
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:138
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:96
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
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:51
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:389
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:350
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:365
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:60
required string event
Definition: replication_group_member_actions.proto:31
Definition: table.h:2551