summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/event_scheduler.h')
-rw-r--r--sql/event_scheduler.h43
1 files changed, 20 insertions, 23 deletions
diff --git a/sql/event_scheduler.h b/sql/event_scheduler.h
index 5ae310bab2a..bd099d10839 100644
--- a/sql/event_scheduler.h
+++ b/sql/event_scheduler.h
@@ -16,7 +16,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+class sp_name;
class Event_timed;
+class Event_db_repository;
class THD;
typedef bool * (*event_timed_identifier_comparator)(Event_timed*, Event_timed*);
@@ -30,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
{
@@ -65,22 +56,22 @@ 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);
bool
- drop_event(THD *thd, Event_timed *et);
+ drop_event(THD *thd, sp_name *name);
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
@@ -91,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();
@@ -136,6 +131,9 @@ private:
Event_timed *
find_event(Event_timed *etn, bool remove_from_q);
+ Event_timed *
+ find_event(sp_name *name, bool remove_from_q);
+
uint
workers_count();
@@ -152,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
@@ -226,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;