3 /* Copyright (c) 2004-2007 MySQL AB
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 Street, 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 class Event_parse_data
;
29 class Event_db_repository
;
31 class Event_scheduler
;
34 enum enum_events_error_code
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 set_opt_event_scheduler() -> 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).
73 /* The order should match the order in opt_typelib */
74 enum enum_opt_event_scheduler
81 /* Possible values of @@event_scheduler variable */
82 static const TYPELIB var_typelib
;
85 set_opt_event_scheduler(char *argument
);
88 get_opt_event_scheduler_str();
90 /* A hack needed for Event_queue_element */
91 static Event_db_repository
*
92 get_db_repository() { return db_repository
; }
95 init(my_bool opt_noacl
);
107 switch_event_scheduler_state(enum enum_opt_event_scheduler new_state
);
110 create_event(THD
*thd
, Event_parse_data
*parse_data
, bool if_exists
);
113 update_event(THD
*thd
, Event_parse_data
*parse_data
,
114 LEX_STRING
*new_dbname
, LEX_STRING
*new_name
);
117 drop_event(THD
*thd
, LEX_STRING dbname
, LEX_STRING name
, bool if_exists
);
120 drop_schema_events(THD
*thd
, char *db
);
123 show_create_event(THD
*thd
, LEX_STRING dbname
, LEX_STRING name
);
125 /* Needed for both SHOW CREATE EVENT and INFORMATION_SCHEMA */
127 reconstruct_interval_expression(String
*buf
, interval_type interval
,
128 longlong expression
);
131 fill_schema_events(THD
*thd
, TABLE_LIST
*tables
, COND
* /* cond */);
134 dump_internal_status();
137 static bool check_if_system_tables_error();
140 load_events_from_db(THD
*thd
);
143 /* Command line option names */
144 static const TYPELIB opt_typelib
;
145 static pthread_mutex_t LOCK_event_metadata
;
146 static Event_queue
*event_queue
;
147 static Event_scheduler
*scheduler
;
148 static Event_db_repository
*db_repository
;
149 /* Current state of Event Scheduler */
150 static enum enum_opt_event_scheduler opt_event_scheduler
;
151 /* Set to TRUE if an error at start up */
152 static bool check_system_tables_error
;
155 /* Prevent use of these */
156 Events(const Events
&);
157 void operator=(Events
&);
161 @} (end of group Event Scheduler)
164 #endif /* _EVENT_H_ */