My Project
event_db_repository.h
Go to the documentation of this file.
00001 #ifndef _EVENT_DB_REPOSITORY_H_
00002 #define _EVENT_DB_REPOSITORY_H_
00003 
00004 /*
00005    Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; version 2 of the License.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
00019 */
00020 
00034 enum enum_events_table_field
00035 {
00036   ET_FIELD_DB = 0, 
00037   ET_FIELD_NAME,
00038   ET_FIELD_BODY,
00039   ET_FIELD_DEFINER,
00040   ET_FIELD_EXECUTE_AT,
00041   ET_FIELD_INTERVAL_EXPR,
00042   ET_FIELD_TRANSIENT_INTERVAL,
00043   ET_FIELD_CREATED,
00044   ET_FIELD_MODIFIED,
00045   ET_FIELD_LAST_EXECUTED,
00046   ET_FIELD_STARTS,
00047   ET_FIELD_ENDS,
00048   ET_FIELD_STATUS,
00049   ET_FIELD_ON_COMPLETION,
00050   ET_FIELD_SQL_MODE,
00051   ET_FIELD_COMMENT,
00052   ET_FIELD_ORIGINATOR,
00053   ET_FIELD_TIME_ZONE,
00054   ET_FIELD_CHARACTER_SET_CLIENT,
00055   ET_FIELD_COLLATION_CONNECTION,
00056   ET_FIELD_DB_COLLATION,
00057   ET_FIELD_BODY_UTF8,
00058   ET_FIELD_COUNT /* a cool trick to count the number of fields :) */
00059 };
00060 
00061 
00062 int
00063 events_table_index_read_for_db(THD *thd, TABLE *schema_table,
00064                                TABLE *event_table);
00065 
00066 int
00067 events_table_scan_all(THD *thd, TABLE *schema_table, TABLE *event_table);
00068 
00069 
00070 class Event_basic;
00071 class Event_parse_data;
00072 
00073 class Event_db_repository
00074 {
00075 public:
00076   Event_db_repository(){}
00077 
00078   bool
00079   create_event(THD *thd, Event_parse_data *parse_data, bool create_if_not,
00080                bool *event_already_exists);
00081 
00082   bool
00083   update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname,
00084                LEX_STRING *new_name);
00085 
00086   bool
00087   drop_event(THD *thd, LEX_STRING db, LEX_STRING name, bool drop_if_exists);
00088 
00089   void
00090   drop_schema_events(THD *thd, LEX_STRING schema);
00091 
00092   bool
00093   find_named_event(LEX_STRING db, LEX_STRING name, TABLE *table);
00094 
00095   bool
00096   load_named_event(THD *thd, LEX_STRING dbname, LEX_STRING name, Event_basic *et);
00097 
00098   static bool
00099   open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table);
00100 
00101   bool
00102   fill_schema_events(THD *thd, TABLE_LIST *tables, const char *db);
00103 
00104   bool
00105   update_timing_fields_for_event(THD *thd,
00106                                  LEX_STRING event_db_name,
00107                                  LEX_STRING event_name,
00108                                  my_time_t last_executed,
00109                                  ulonglong status);
00110 public:
00111   static bool
00112   check_system_tables(THD *thd);
00113 private:
00114   bool
00115   index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table,
00116                             const char *db);
00117 
00118   bool
00119   table_scan_all_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table);
00120 
00121 private:
00122   /* Prevent use of these */
00123   Event_db_repository(const Event_db_repository &);
00124   void operator=(Event_db_repository &);
00125 };
00126 
00130 #endif /* _EVENT_DB_REPOSITORY_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines