mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 00:54:30 +02:00
WL#3337 (Events new architecture)
5th cut, moved DB related code to Event_db_repository and updated accordingly the remanining code. Moved change/restore_security_context() to class THD Removed events_priv.h Next step is to reorganize create/update_event() and parsing for them. But probably some other refactoring could be done in the meanwhile. The changes so far pass the test suite. BitKeeper/deleted/.del-events_priv.h~2e8bce2cf35997df: Delete: sql/events_priv.h sql/Makefile.am: events_priv.h is no more sql/event_data_objects.cc: reorganize events code sql/event_data_objects.h: reorganize events code sql/event_db_repository.cc: reorganize events code sql/event_db_repository.h: reorganize events code sql/event_scheduler.cc: reorganize events code sql/event_scheduler.h: reorganize events code sql/events.cc: reorganize events code sql/events.h: reorganize events code sql/mysqld.cc: reorganize events code sql/set_var.cc: reorganize events code sql/sql_class.cc: add ::change_security_context() and restore_security_context() sql/sql_class.h: add ::change_security_context() and restore_security_context() sql/sql_db.cc: reorganize Events code sql/sql_parse.cc: reorganize Events code sql/sql_show.cc: reorganize Events code
This commit is contained in:
parent
cace147c63
commit
acefb78bc3
17 changed files with 1210 additions and 1072 deletions
115
sql/events.h
115
sql/events.h
|
|
@ -20,65 +20,42 @@ class sp_name;
|
|||
class Event_timed;
|
||||
class Event_parse_data;
|
||||
|
||||
#include "event_db_repository.h"
|
||||
|
||||
/* Return codes */
|
||||
enum enum_events_error_code
|
||||
{
|
||||
OP_OK= 0,
|
||||
OP_NOT_RUNNING,
|
||||
OP_CANT_KILL,
|
||||
OP_CANT_INIT,
|
||||
OP_DISABLED_EVENT,
|
||||
OP_LOAD_ERROR,
|
||||
OP_ALREADY_EXISTS
|
||||
};
|
||||
|
||||
int
|
||||
sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
|
||||
|
||||
|
||||
class Events
|
||||
{
|
||||
public:
|
||||
/*
|
||||
Quite NOT the best practice and will be removed once
|
||||
Event_timed::drop() and Event_timed is fixed not do drop directly
|
||||
or other scheme will be found.
|
||||
*/
|
||||
friend class Event_timed;
|
||||
|
||||
static ulong opt_event_scheduler;
|
||||
static TYPELIB opt_typelib;
|
||||
|
||||
enum enum_table_field
|
||||
{
|
||||
FIELD_DB = 0,
|
||||
FIELD_NAME,
|
||||
FIELD_BODY,
|
||||
FIELD_DEFINER,
|
||||
FIELD_EXECUTE_AT,
|
||||
FIELD_INTERVAL_EXPR,
|
||||
FIELD_TRANSIENT_INTERVAL,
|
||||
FIELD_CREATED,
|
||||
FIELD_MODIFIED,
|
||||
FIELD_LAST_EXECUTED,
|
||||
FIELD_STARTS,
|
||||
FIELD_ENDS,
|
||||
FIELD_STATUS,
|
||||
FIELD_ON_COMPLETION,
|
||||
FIELD_SQL_MODE,
|
||||
FIELD_COMMENT,
|
||||
FIELD_COUNT /* a cool trick to count the number of fields :) */
|
||||
};
|
||||
|
||||
static int
|
||||
create_event(THD *thd, Event_timed *et, Event_parse_data *parse_data,
|
||||
uint create_options, uint *rows_affected);
|
||||
|
||||
static int
|
||||
update_event(THD *thd, Event_timed *et, Event_parse_data *parse_data,
|
||||
sp_name *new_name, uint *rows_affected);
|
||||
|
||||
static int
|
||||
drop_event(THD *thd, sp_name *name, bool drop_if_exists, uint *rows_affected);
|
||||
|
||||
static int
|
||||
open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table);
|
||||
|
||||
static int
|
||||
show_create_event(THD *thd, sp_name *spn);
|
||||
|
||||
static int
|
||||
reconstruct_interval_expression(String *buf, interval_type interval,
|
||||
longlong expression);
|
||||
|
||||
static int
|
||||
drop_schema_events(THD *thd, char *db);
|
||||
|
||||
static int
|
||||
dump_internal_status(THD *thd);
|
||||
|
||||
static int
|
||||
init();
|
||||
|
||||
static void
|
||||
shutdown();
|
||||
deinit();
|
||||
|
||||
static void
|
||||
init_mutexes();
|
||||
|
|
@ -86,8 +63,48 @@ public:
|
|||
static void
|
||||
destroy_mutexes();
|
||||
|
||||
static Events*
|
||||
get_instance();
|
||||
|
||||
int
|
||||
create_event(THD *thd, Event_timed *et, Event_parse_data *parse_data,
|
||||
uint create_options, uint *rows_affected);
|
||||
|
||||
int
|
||||
update_event(THD *thd, Event_timed *et, Event_parse_data *parse_data,
|
||||
sp_name *new_name, uint *rows_affected);
|
||||
|
||||
int
|
||||
drop_event(THD *thd, sp_name *name, bool drop_if_exists, uint *rows_affected);
|
||||
|
||||
int
|
||||
open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table);
|
||||
|
||||
int
|
||||
show_create_event(THD *thd, sp_name *spn);
|
||||
|
||||
/* Needed for both SHOW CREATE EVENT and INFORMATION_SCHEMA */
|
||||
static int
|
||||
reconstruct_interval_expression(String *buf, interval_type interval,
|
||||
longlong expression);
|
||||
|
||||
int
|
||||
drop_schema_events(THD *thd, char *db);
|
||||
|
||||
int
|
||||
dump_internal_status(THD *thd);
|
||||
|
||||
Event_db_repository db_repository;
|
||||
|
||||
private:
|
||||
/* Singleton DP is used */
|
||||
Events(){}
|
||||
~Events(){}
|
||||
|
||||
/* Singleton instance */
|
||||
static Events singleton;
|
||||
|
||||
|
||||
/* Prevent use of these */
|
||||
Events(const Events &);
|
||||
void operator=(Events &);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue