My Project
|
00001 /* 00002 Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; version 2 of the License. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software Foundation, 00015 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 00016 00017 #ifndef _EVENT_PARSE_DATA_H_ 00018 #define _EVENT_PARSE_DATA_H_ 00019 00020 #include "sql_alloc.h" 00021 00022 class Item; 00023 class THD; 00024 class sp_name; 00025 00026 #define EVEX_GET_FIELD_FAILED -2 00027 #define EVEX_BAD_PARAMS -5 00028 #define EVEX_MICROSECOND_UNSUP -6 00029 #define EVEX_MAX_INTERVAL_VALUE 1000000000L 00030 00031 class Event_parse_data : public Sql_alloc 00032 { 00033 public: 00034 /* 00035 ENABLED = feature can function normally (is turned on) 00036 SLAVESIDE_DISABLED = feature is turned off on slave 00037 DISABLED = feature is turned off 00038 */ 00039 enum enum_status 00040 { 00041 ENABLED = 1, 00042 DISABLED, 00043 SLAVESIDE_DISABLED 00044 }; 00045 00046 enum enum_on_completion 00047 { 00048 /* 00049 On CREATE EVENT, DROP is the DEFAULT as per the docs. 00050 On ALTER EVENT, "no change" is the DEFAULT. 00051 */ 00052 ON_COMPLETION_DEFAULT = 0, 00053 ON_COMPLETION_DROP, 00054 ON_COMPLETION_PRESERVE 00055 }; 00056 00057 int on_completion; 00058 int status; 00059 bool status_changed; 00060 longlong originator; 00061 /* 00062 do_not_create will be set if STARTS time is in the past and 00063 on_completion == ON_COMPLETION_DROP. 00064 */ 00065 bool do_not_create; 00066 00067 bool body_changed; 00068 00069 LEX_STRING dbname; 00070 LEX_STRING name; 00071 LEX_STRING definer;// combination of user and host 00072 LEX_STRING comment; 00073 00074 Item* item_starts; 00075 Item* item_ends; 00076 Item* item_execute_at; 00077 00078 my_time_t starts; 00079 my_time_t ends; 00080 my_time_t execute_at; 00081 my_bool starts_null; 00082 my_bool ends_null; 00083 my_bool execute_at_null; 00084 00085 sp_name *identifier; 00086 Item* item_expression; 00087 longlong expression; 00088 interval_type interval; 00089 00090 static Event_parse_data * 00091 new_instance(THD *thd); 00092 00093 bool 00094 check_parse_data(THD *thd); 00095 00096 bool 00097 check_dates(THD *thd, int previous_on_completion); 00098 00099 private: 00100 00101 void 00102 init_definer(THD *thd); 00103 00104 void 00105 init_name(THD *thd, sp_name *spn); 00106 00107 int 00108 init_execute_at(THD *thd); 00109 00110 int 00111 init_interval(THD *thd); 00112 00113 int 00114 init_starts(THD *thd); 00115 00116 int 00117 init_ends(THD *thd); 00118 00119 Event_parse_data(); 00120 ~Event_parse_data(); 00121 00122 void 00123 report_bad_value(const char *item_name, Item *bad_item); 00124 00125 void 00126 check_if_in_the_past(THD *thd, my_time_t ltime_utc); 00127 00128 Event_parse_data(const Event_parse_data &); /* Prevent use of these */ 00129 void check_originator_id(THD *thd); 00130 void operator=(Event_parse_data &); 00131 }; 00132 #endif