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