MySQL  8.0.27
Source Code Documentation
event_parse_data.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2008, 2021, Oracle and/or its affiliates.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License, version 2.0,
6  as published by the Free Software Foundation.
7 
8  This program is also distributed with certain software (including
9  but not limited to OpenSSL) that is licensed under separate terms,
10  as designated in a particular file or component or in included license
11  documentation. The authors of MySQL hereby grant you an additional
12  permission to link the program and your derivative works with the
13  separately licensed software that they have included with MySQL.
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 _EVENT_PARSE_DATA_H_
25 #define _EVENT_PARSE_DATA_H_
26 
27 #include <stddef.h>
28 
29 #include "lex_string.h"
30 #include "my_dbug.h"
31 #include "my_inttypes.h"
32 #include "my_time.h" // interval_type
33 
34 class Item;
35 class THD;
36 class sp_name;
37 
38 #define EVEX_GET_FIELD_FAILED -2
39 #define EVEX_BAD_PARAMS -5
40 #define EVEX_MICROSECOND_UNSUP -6
41 #define EVEX_MAX_INTERVAL_VALUE 1000000000L
42 
44  public:
45  /*
46  ENABLED = feature can function normally (is turned on)
47  SLAVESIDE_DISABLED = feature is turned off on slave
48  DISABLED = feature is turned off
49  */
51 
53  /*
54  On CREATE EVENT, DROP is the DEFAULT as per the docs.
55  On ALTER EVENT, "no change" is the DEFAULT.
56  */
60  };
61 
63  int status;
66  /*
67  do_not_create will be set if STARTS time is in the past and
68  on_completion == ON_COMPLETION_DROP.
69  */
71 
73 
76  LEX_STRING definer; // combination of user and host
78 
82 
87  bool ends_null;
89 
94 
95  bool check_parse_data(THD *thd);
96 
97  bool check_dates(THD *thd, int previous_on_completion);
98 
102  status_changed(false),
103  do_not_create(false),
104  body_changed(false),
108  starts_null(true),
109  ends_null(true),
110  execute_at_null(true),
112  expression(0) {
113  DBUG_TRACE;
114 
115  /* Actually in the parser STARTS is always set */
116  starts = ends = execute_at = 0;
117 
118  comment.str = nullptr;
119  comment.length = 0;
120 
121  return;
122  }
123 
124  ~Event_parse_data() = default;
125 
126  private:
127  void init_definer(THD *thd);
128 
129  void init_name(THD *thd, sp_name *spn);
130 
131  int init_execute_at(THD *thd);
132 
133  int init_interval(THD *thd);
134 
135  int init_starts(THD *thd);
136 
137  int init_ends(THD *thd);
138 
139  void report_bad_value(THD *thd, const char *item_name, Item *bad_item);
140 
141  void check_if_in_the_past(THD *thd, my_time_t ltime_utc);
142 
143  Event_parse_data(const Event_parse_data &); /* Prevent use of these */
144  void check_originator_id(THD *thd);
146 };
147 #endif
Definition: event_parse_data.h:43
void operator=(Event_parse_data &)
bool check_parse_data(THD *thd)
Definition: event_parse_data.cc:435
bool check_dates(THD *thd, int previous_on_completion)
Definition: event_parse_data.cc:138
Item * item_execute_at
Definition: event_parse_data.h:81
void report_bad_value(THD *thd, const char *item_name, Item *bad_item)
Definition: event_parse_data.cc:411
bool starts_null
Definition: event_parse_data.h:86
LEX_STRING definer
Definition: event_parse_data.h:76
int init_ends(THD *thd)
Definition: event_parse_data.cc:370
longlong expression
Definition: event_parse_data.h:92
interval_type interval
Definition: event_parse_data.h:93
Item * item_starts
Definition: event_parse_data.h:79
LEX_CSTRING dbname
Definition: event_parse_data.h:74
void init_name(THD *thd, sp_name *spn)
Definition: event_parse_data.cc:59
Event_parse_data(const Event_parse_data &)
my_time_t starts
Definition: event_parse_data.h:83
sp_name * identifier
Definition: event_parse_data.h:90
~Event_parse_data()=default
void init_definer(THD *thd)
Definition: event_parse_data.cc:463
Item * item_ends
Definition: event_parse_data.h:80
my_time_t execute_at
Definition: event_parse_data.h:85
my_time_t ends
Definition: event_parse_data.h:84
bool do_not_create
Definition: event_parse_data.h:70
int on_completion
Definition: event_parse_data.h:62
void check_originator_id(THD *thd)
Set the originator id of the event to the server_id if executing on the master or set to the server_i...
Definition: event_parse_data.cc:500
void check_if_in_the_past(THD *thd, my_time_t ltime_utc)
Definition: event_parse_data.cc:87
bool execute_at_null
Definition: event_parse_data.h:88
int status
Definition: event_parse_data.h:63
enum_status
Definition: event_parse_data.h:50
@ ENABLED
Definition: event_parse_data.h:50
@ SLAVESIDE_DISABLED
Definition: event_parse_data.h:50
@ DISABLED
Definition: event_parse_data.h:50
bool ends_null
Definition: event_parse_data.h:87
int init_interval(THD *thd)
Definition: event_parse_data.cc:210
bool body_changed
Definition: event_parse_data.h:72
Event_parse_data()
Definition: event_parse_data.h:99
enum_on_completion
Definition: event_parse_data.h:52
@ ON_COMPLETION_DEFAULT
Definition: event_parse_data.h:57
@ ON_COMPLETION_PRESERVE
Definition: event_parse_data.h:59
@ ON_COMPLETION_DROP
Definition: event_parse_data.h:58
longlong originator
Definition: event_parse_data.h:65
Item * item_expression
Definition: event_parse_data.h:91
LEX_CSTRING name
Definition: event_parse_data.h:75
bool status_changed
Definition: event_parse_data.h:64
int init_starts(THD *thd)
Definition: event_parse_data.cc:321
LEX_STRING comment
Definition: event_parse_data.h:77
int init_execute_at(THD *thd)
Definition: event_parse_data.cc:159
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
Definition: sp_head.h:119
Dialog Client Authentication nullptr
Definition: dialog.cc:352
DBUG_TRACE
Definition: do_ctype.cc:46
Some integer typedefs for easier portability.
long long int longlong
Definition: my_inttypes.h:54
Interface for low level time utilities.
[] long int my_time_t
Portable time_t replacement.
interval_type
Available interval types used in any statement.
Definition: my_time.h:403
Definition: mysql_lex_string.h:39
Definition: mysql_lex_string.h:34
char * str
Definition: mysql_lex_string.h:35
size_t length
Definition: mysql_lex_string.h:36