summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.h
diff options
context:
space:
mode:
authorandrey@lmy004. <>2006-06-28 01:28:03 +0200
committerandrey@lmy004. <>2006-06-28 01:28:03 +0200
commit9309fae9b5261e888f15d903b4110b272ffdb917 (patch)
treebf91f4ab6e97d25e3da5172541a1f76237dccfe4 /sql/event_scheduler.h
parent0c439c9f761d804478b0826d5e3e3e60c4d59d97 (diff)
downloadmariadb-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/event_scheduler.h')
-rw-r--r--sql/event_scheduler.h37
1 files changed, 15 insertions, 22 deletions
diff --git a/sql/event_scheduler.h b/sql/event_scheduler.h
index 183ef450be2..bd099d10839 100644
--- a/sql/event_scheduler.h
+++ b/sql/event_scheduler.h
@@ -18,6 +18,7 @@
class sp_name;
class Event_timed;
+class Event_db_repository;
class THD;
typedef bool * (*event_timed_identifier_comparator)(Event_timed*, Event_timed*);
@@ -31,17 +32,6 @@ events_shutdown();
class Event_scheduler
{
public:
- /* Return codes */
- enum enum_error_code
- {
- OP_OK= 0,
- OP_NOT_RUNNING,
- OP_CANT_KILL,
- OP_CANT_INIT,
- OP_DISABLED_EVENT,
- OP_LOAD_ERROR,
- OP_ALREADY_EXISTS
- };
enum enum_state
{
@@ -66,10 +56,10 @@ public:
/* Methods for queue management follow */
- enum enum_error_code
+ int
create_event(THD *thd, Event_timed *et, bool check_existence);
- enum enum_error_code
+ int
update_event(THD *thd, Event_timed *et, LEX_STRING *new_schema,
LEX_STRING *new_name);
@@ -78,10 +68,10 @@ public:
int
- drop_schema_events(THD *thd, LEX_STRING *schema);
+ drop_schema_events(THD *thd, LEX_STRING schema);
int
- drop_user_events(THD *thd, LEX_STRING *definer, uint *dropped_num)
+ drop_user_events(THD *thd, LEX_STRING *definer)
{ DBUG_ASSERT(0); return 0;}
uint
@@ -92,20 +82,24 @@ public:
bool
start();
- enum enum_error_code
+ int
stop();
bool
start_suspended();
+ /*
+ Need to be public because has to be called from the function
+ passed to pthread_create.
+ */
bool
run(THD *thd);
- enum enum_error_code
+ int
suspend_or_resume(enum enum_suspend_or_resume action);
bool
- init();
+ init(Event_db_repository *db_repo);
void
destroy();
@@ -156,14 +150,11 @@ private:
void
stop_all_running_events(THD *thd);
- enum enum_error_code
- load_named_event(THD *thd, Event_timed *etn, Event_timed **etn_new);
-
int
load_events_from_db(THD *thd);
void
- drop_matching_events(THD *thd, LEX_STRING *pattern,
+ drop_matching_events(THD *thd, LEX_STRING pattern,
bool (*)(Event_timed *,LEX_STRING *));
bool
@@ -230,6 +221,8 @@ private:
/* The MEM_ROOT of the object */
MEM_ROOT scheduler_root;
+ Event_db_repository *db_repository;
+
/* The sorted queue with the Event_timed objects */
QUEUE queue;