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