3
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
19
@defgroup Event_Scheduler Event Scheduler
20
@ingroup Runtime_Environment
25
A public interface of Events_Scheduler module.
28
#ifdef HAVE_PSI_INTERFACE
29
extern PSI_mutex_key key_event_scheduler_LOCK_scheduler_state;
30
extern PSI_cond_key key_event_scheduler_COND_state;
31
extern PSI_thread_key key_thread_event_scheduler, key_thread_event_worker;
32
#endif /* HAVE_PSI_INTERFACE */
34
#include "sql_string.h" /* LEX_STRING */
35
#include "my_time.h" /* interval_type */
37
class Event_db_repository;
38
class Event_parse_data;
40
class Event_scheduler;
43
typedef class Item COND;
44
typedef struct charset_info_st CHARSET_INFO;
47
sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
50
@brief A facade to the functionality of the Event Scheduler.
52
Every public operation against the scheduler has to be executed via the
53
interface provided by a static method of this class. No instance of this
54
class is ever created and it has no non-static data members.
56
The life cycle of the Events module is the following:
59
init_mutexes() -> init()
60
When the server is running:
61
create_event(), drop_event(), start_or_stop_event_scheduler(), etc
63
deinit(), destroy_mutexes().
65
The peculiar initialization and shutdown cycle is an adaptation to the
66
outside server startup/shutdown framework and mimics the rest of MySQL
67
subsystems (ACL, time zone tables, etc).
74
the following block is to support --event-scheduler command line option
75
and the @@global.event_scheduler SQL variable.
78
enum enum_opt_event_scheduler { EVENTS_OFF, EVENTS_ON, EVENTS_DISABLED };
79
/* Protected using LOCK_global_system_variables only. */
80
static ulong opt_event_scheduler;
81
static bool check_if_system_tables_error();
82
static bool start(int *err_no);
86
/* A hack needed for Event_queue_element */
87
static Event_db_repository *
88
get_db_repository() { return db_repository; }
91
init(my_bool opt_noacl);
103
create_event(THD *thd, Event_parse_data *parse_data, bool if_exists);
106
update_event(THD *thd, Event_parse_data *parse_data,
107
LEX_STRING *new_dbname, LEX_STRING *new_name);
110
drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists);
113
drop_schema_events(THD *thd, char *db);
116
show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name);
118
/* Needed for both SHOW CREATE EVENT and INFORMATION_SCHEMA */
120
reconstruct_interval_expression(String *buf, interval_type interval,
121
longlong expression);
124
fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */);
127
dump_internal_status();
132
load_events_from_db(THD *thd);
135
static Event_queue *event_queue;
136
static Event_scheduler *scheduler;
137
static Event_db_repository *db_repository;
138
/* Set to TRUE if an error at start up */
139
static bool check_system_tables_error;
142
/* Prevent use of these */
143
Events(const Events &);
144
void operator=(Events &);
148
@} (end of group Event Scheduler)
151
#endif /* _EVENT_H_ */