diff options
author | andrey@lmy004. <> | 2006-06-28 01:28:03 +0200 |
---|---|---|
committer | andrey@lmy004. <> | 2006-06-28 01:28:03 +0200 |
commit | 9309fae9b5261e888f15d903b4110b272ffdb917 (patch) | |
tree | bf91f4ab6e97d25e3da5172541a1f76237dccfe4 /sql/events.h | |
parent | 0c439c9f761d804478b0826d5e3e3e60c4d59d97 (diff) | |
download | mariadb-git-9309fae9b5261e888f15d903b4110b272ffdb917.tar.gz |
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.
Diffstat (limited to 'sql/events.h')
-rw-r--r-- | sql/events.h | 95 |
1 files changed, 56 insertions, 39 deletions
diff --git a/sql/events.h b/sql/events.h index d56a544493d..339f87c3806 100644 --- a/sql/events.h +++ b/sql/events.h @@ -20,74 +20,91 @@ 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 + init(); + + static void + deinit(); + + static void + init_mutexes(); + + 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); - static int + int update_event(THD *thd, Event_timed *et, Event_parse_data *parse_data, sp_name *new_name, uint *rows_affected); - static int + int drop_event(THD *thd, sp_name *name, bool drop_if_exists, uint *rows_affected); - static int + int open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table); - static int + 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); - static int + int drop_schema_events(THD *thd, char *db); - static int + int dump_internal_status(THD *thd); - - static int - init(); - - static void - shutdown(); - - static void - init_mutexes(); - - static void - destroy_mutexes(); + 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 &); |