mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / sql / event_db_repository.h
blobee33ce0b0151ab39197a7b47007f850c90d25b83
1 #ifndef _EVENT_DB_REPOSITORY_H_
2 #define _EVENT_DB_REPOSITORY_H_
3 /* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
18 /**
19 @addtogroup Event_Scheduler
22 @file event_db_repository.h
24 Data Dictionary related operations of Event Scheduler.
26 This is a private header file of Events module. Please do not include it
27 directly. All public declarations of Events module should be stored in
28 events.h and event_data_objects.h.
31 enum enum_events_table_field
33 ET_FIELD_DB = 0,
34 ET_FIELD_NAME,
35 ET_FIELD_BODY,
36 ET_FIELD_DEFINER,
37 ET_FIELD_EXECUTE_AT,
38 ET_FIELD_INTERVAL_EXPR,
39 ET_FIELD_TRANSIENT_INTERVAL,
40 ET_FIELD_CREATED,
41 ET_FIELD_MODIFIED,
42 ET_FIELD_LAST_EXECUTED,
43 ET_FIELD_STARTS,
44 ET_FIELD_ENDS,
45 ET_FIELD_STATUS,
46 ET_FIELD_ON_COMPLETION,
47 ET_FIELD_SQL_MODE,
48 ET_FIELD_COMMENT,
49 ET_FIELD_ORIGINATOR,
50 ET_FIELD_TIME_ZONE,
51 ET_FIELD_CHARACTER_SET_CLIENT,
52 ET_FIELD_COLLATION_CONNECTION,
53 ET_FIELD_DB_COLLATION,
54 ET_FIELD_BODY_UTF8,
55 ET_FIELD_COUNT /* a cool trick to count the number of fields :) */
59 int
60 events_table_index_read_for_db(THD *thd, TABLE *schema_table,
61 TABLE *event_table);
63 int
64 events_table_scan_all(THD *thd, TABLE *schema_table, TABLE *event_table);
67 class Event_basic;
68 class Event_parse_data;
70 class Event_db_repository
72 public:
73 Event_db_repository(){}
75 bool
76 create_event(THD *thd, Event_parse_data *parse_data, bool create_if_not,
77 bool *event_already_exists);
79 bool
80 update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname,
81 LEX_STRING *new_name);
83 bool
84 drop_event(THD *thd, LEX_STRING db, LEX_STRING name, bool drop_if_exists);
86 void
87 drop_schema_events(THD *thd, LEX_STRING schema);
89 bool
90 find_named_event(LEX_STRING db, LEX_STRING name, TABLE *table);
92 bool
93 load_named_event(THD *thd, LEX_STRING dbname, LEX_STRING name, Event_basic *et);
95 bool
96 open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table);
98 bool
99 fill_schema_events(THD *thd, TABLE_LIST *tables, const char *db);
101 bool
102 update_timing_fields_for_event(THD *thd,
103 LEX_STRING event_db_name,
104 LEX_STRING event_name,
105 bool update_last_executed,
106 my_time_t last_executed,
107 bool update_status,
108 ulonglong status);
109 public:
110 static bool
111 check_system_tables(THD *thd);
112 private:
113 void
114 drop_events_by_field(THD *thd, enum enum_events_table_field field,
115 LEX_STRING field_value);
116 bool
117 index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table,
118 const char *db);
120 bool
121 table_scan_all_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table);
123 private:
124 /* Prevent use of these */
125 Event_db_repository(const Event_db_repository &);
126 void operator=(Event_db_repository &);
130 @} (End of group Event_Scheduler)
132 #endif /* _EVENT_DB_REPOSITORY_H_ */