summaryrefslogtreecommitdiff
path: root/sql/events.h
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-06-28 01:28:03 +0200
committerunknown <andrey@lmy004.>2006-06-28 01:28:03 +0200
commitacefb78bc3fbf28376d8713e1dc9f056dc3cdbf6 (patch)
treebf91f4ab6e97d25e3da5172541a1f76237dccfe4 /sql/events.h
parentcace147c63a03b4dc9bd3e55ae3bda4f5e9db97b (diff)
downloadmariadb-git-acefb78bc3fbf28376d8713e1dc9f056dc3cdbf6.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. 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
Diffstat (limited to 'sql/events.h')
-rw-r--r--sql/events.h95
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 &);