~vadim-tk/percona-server/percona-galera-5.1.57

« back to all changes in this revision

Viewing changes to sql/event_parse_data.h

  • Committer: root
  • Date: 2011-07-10 16:09:24 UTC
  • Revision ID: root@r815.office.percona.com-20110710160924-fyffqsbaclgu6vui
Initial port

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef _EVENT_PARSE_DATA_H_
 
17
#define _EVENT_PARSE_DATA_H_
 
18
 
 
19
#define EVEX_GET_FIELD_FAILED   -2
 
20
#define EVEX_BAD_PARAMS         -5
 
21
#define EVEX_MICROSECOND_UNSUP  -6
 
22
#define EVEX_MAX_INTERVAL_VALUE 1000000000L
 
23
 
 
24
class Event_parse_data : public Sql_alloc
 
25
{
 
26
public:
 
27
  /*
 
28
    ENABLED = feature can function normally (is turned on)
 
29
    SLAVESIDE_DISABLED = feature is turned off on slave
 
30
    DISABLED = feature is turned off
 
31
  */
 
32
  enum enum_status
 
33
  {
 
34
    ENABLED = 1,
 
35
    DISABLED,
 
36
    SLAVESIDE_DISABLED  
 
37
  };
 
38
 
 
39
  enum enum_on_completion
 
40
  {
 
41
    /*
 
42
      On CREATE EVENT, DROP is the DEFAULT as per the docs.
 
43
      On ALTER  EVENT, "no change" is the DEFAULT.
 
44
    */
 
45
    ON_COMPLETION_DEFAULT = 0,
 
46
    ON_COMPLETION_DROP,
 
47
    ON_COMPLETION_PRESERVE
 
48
  };
 
49
 
 
50
  int on_completion;
 
51
  int status;
 
52
  longlong originator;
 
53
  /*
 
54
    do_not_create will be set if STARTS time is in the past and
 
55
    on_completion == ON_COMPLETION_DROP.
 
56
  */
 
57
  bool do_not_create;
 
58
 
 
59
  bool body_changed;
 
60
 
 
61
  LEX_STRING dbname;
 
62
  LEX_STRING name;
 
63
  LEX_STRING definer;// combination of user and host
 
64
  LEX_STRING comment;
 
65
 
 
66
  Item* item_starts;
 
67
  Item* item_ends;
 
68
  Item* item_execute_at;
 
69
 
 
70
  my_time_t starts;
 
71
  my_time_t ends;
 
72
  my_time_t execute_at;
 
73
  my_bool starts_null;
 
74
  my_bool ends_null;
 
75
  my_bool execute_at_null;
 
76
 
 
77
  sp_name *identifier;
 
78
  Item* item_expression;
 
79
  longlong expression;
 
80
  interval_type interval;
 
81
 
 
82
  static Event_parse_data *
 
83
  new_instance(THD *thd);
 
84
 
 
85
  bool
 
86
  check_parse_data(THD *thd);
 
87
 
 
88
  bool
 
89
  check_dates(THD *thd, int previous_on_completion);
 
90
 
 
91
private:
 
92
 
 
93
  void
 
94
  init_definer(THD *thd);
 
95
 
 
96
  void
 
97
  init_name(THD *thd, sp_name *spn);
 
98
 
 
99
  int
 
100
  init_execute_at(THD *thd);
 
101
 
 
102
  int
 
103
  init_interval(THD *thd);
 
104
 
 
105
  int
 
106
  init_starts(THD *thd);
 
107
 
 
108
  int
 
109
  init_ends(THD *thd);
 
110
 
 
111
  Event_parse_data();
 
112
  ~Event_parse_data();
 
113
 
 
114
  void
 
115
  report_bad_value(const char *item_name, Item *bad_item);
 
116
 
 
117
  void
 
118
  check_if_in_the_past(THD *thd, my_time_t ltime_utc);
 
119
 
 
120
  Event_parse_data(const Event_parse_data &);   /* Prevent use of these */
 
121
  void check_originator_id(THD *thd);
 
122
  void operator=(Event_parse_data &);
 
123
};
 
124
#endif