MySQL  8.0.27
Source Code Documentation
event_db_repository.h
Go to the documentation of this file.
1 #ifndef _EVENT_DB_REPOSITORY_H_
2 #define _EVENT_DB_REPOSITORY_H_
3 
4 /*
5  Copyright (c) 2006, 2021, Oracle and/or its affiliates.
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License, version 2.0,
9  as published by the Free Software Foundation.
10 
11  This program is also distributed with certain software (including
12  but not limited to OpenSSL) that is licensed under separate terms,
13  as designated in a particular file or component or in included license
14  documentation. The authors of MySQL hereby grant you an additional
15  permission to link the program and your derivative works with the
16  separately licensed software that they have included with MySQL.
17 
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License, version 2.0, for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27 
28 #include "lex_string.h"
29 #include "my_inttypes.h"
30 
31 class Event_basic;
32 class Event_parse_data;
33 class THD;
34 
35 typedef long my_time_t;
36 
37 namespace dd {
38 class Schema;
39 }
40 
41 /*
42  Fields in mysql.event table in 5.7. This enum is used to
43  read and update mysql.events dictionary table during upgrade
44  scenario.
45 
46  Note: This enum should not be used for other purpose
47  as it will be removed eventually.
48 */
73 };
74 
75 /**
76  @addtogroup Event_Scheduler
77  @{
78 
79  @file event_db_repository.h
80 
81  Data Dictionary related operations of Event Scheduler.
82 
83  This is a private header file of Events module. Please do not include it
84  directly. All public declarations of Events module should be stored in
85  events.h and event_data_objects.h.
86 */
87 
89  Event_db_repository() = default;
90 
91  public:
92  static bool create_event(THD *thd, Event_parse_data *parse_data,
93  bool create_if_not, bool *event_already_exists);
94 
95  static bool update_event(THD *thd, Event_parse_data *parse_data,
96  const LEX_CSTRING *new_dbname,
97  const LEX_CSTRING *new_name);
98 
99  static bool drop_event(THD *thd, LEX_CSTRING db, LEX_CSTRING name,
100  bool drop_if_exists, bool *event_exists);
101 
102  static bool drop_schema_events(THD *thd, const dd::Schema &schema);
103 
104  static bool load_named_event(THD *thd, LEX_CSTRING dbname, LEX_CSTRING name,
105  Event_basic *et);
106 
107  static bool update_timing_fields_for_event(THD *thd,
108  LEX_CSTRING event_db_name,
109  LEX_CSTRING event_name,
110  my_time_t last_executed,
111  ulonglong status);
112 
113  // Disallow copy construction and assignment.
115  void operator=(Event_db_repository &) = delete;
116 };
117 
118 /**
119  @} (End of group Event_Scheduler)
120 */
121 #endif /* _EVENT_DB_REPOSITORY_H_ */
Definition: event_data_objects.h:77
Definition: event_db_repository.h:88
Event_db_repository(const Event_db_repository &)=delete
Event_db_repository()=default
void operator=(Event_db_repository &)=delete
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_class.h:821
Definition: schema.h:62
enum_events_table_field
Definition: event_db_repository.h:49
@ ET_FIELD_STARTS
Definition: event_db_repository.h:60
@ ET_FIELD_TIME_ZONE
Definition: event_db_repository.h:67
@ ET_FIELD_DB
Definition: event_db_repository.h:50
@ ET_FIELD_EXECUTE_AT
Definition: event_db_repository.h:54
@ ET_FIELD_COUNT
Definition: event_db_repository.h:72
@ ET_FIELD_TRANSIENT_INTERVAL
Definition: event_db_repository.h:56
@ ET_FIELD_LAST_EXECUTED
Definition: event_db_repository.h:59
@ ET_FIELD_BODY_UTF8
Definition: event_db_repository.h:71
@ ET_FIELD_STATUS
Definition: event_db_repository.h:62
@ ET_FIELD_CREATED
Definition: event_db_repository.h:57
@ ET_FIELD_BODY
Definition: event_db_repository.h:52
@ ET_FIELD_SQL_MODE
Definition: event_db_repository.h:64
@ ET_FIELD_DB_COLLATION
Definition: event_db_repository.h:70
@ ET_FIELD_MODIFIED
Definition: event_db_repository.h:58
@ ET_FIELD_CHARACTER_SET_CLIENT
Definition: event_db_repository.h:68
@ ET_FIELD_DEFINER
Definition: event_db_repository.h:53
@ ET_FIELD_ORIGINATOR
Definition: event_db_repository.h:66
@ ET_FIELD_NAME
Definition: event_db_repository.h:51
@ ET_FIELD_INTERVAL_EXPR
Definition: event_db_repository.h:55
@ ET_FIELD_ON_COMPLETION
Definition: event_db_repository.h:63
@ ET_FIELD_COLLATION_CONNECTION
Definition: event_db_repository.h:69
@ ET_FIELD_ENDS
Definition: event_db_repository.h:61
@ ET_FIELD_COMMENT
Definition: event_db_repository.h:65
long my_time_t
Definition: event_db_repository.h:33
static bool drop_event(THD *thd, LEX_CSTRING db, LEX_CSTRING name, bool drop_if_exists, bool *event_exists)
Delete event.
Definition: event_db_repository.cc:205
static bool update_event(THD *thd, Event_parse_data *parse_data, const LEX_CSTRING *new_dbname, const LEX_CSTRING *new_name)
Used to execute ALTER EVENT.
Definition: event_db_repository.cc:121
static bool load_named_event(THD *thd, LEX_CSTRING dbname, LEX_CSTRING name, Event_basic *et)
Looks for a named event in the Data Dictionary and load it.
Definition: event_db_repository.cc:294
static bool update_timing_fields_for_event(THD *thd, LEX_CSTRING event_db_name, LEX_CSTRING event_name, my_time_t last_executed, ulonglong status)
Update the event in Data Dictionary with changed status and/or last execution time.
Definition: event_db_repository.cc:326
static bool create_event(THD *thd, Event_parse_data *parse_data, bool create_if_not, bool *event_already_exists)
Creates an event object and persist to Data Dictionary.
Definition: event_db_repository.cc:69
static bool drop_schema_events(THD *thd, const dd::Schema &schema)
Drops all events in the selected database.
Definition: event_db_repository.cc:259
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
[] long int my_time_t
Portable time_t replacement.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:60
case opt name
Definition: sslopt-case.h:32
Definition: mysql_lex_string.h:39