~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-proposed

« back to all changes in this revision

Viewing changes to sql/item_timefunc.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2006 MySQL AB
 
1
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
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 */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
15
*/
15
16
 
16
17
 
17
18
/* Function items used by mysql */
70
71
  enum_monotonicity_info get_monotonicity_info() const;
71
72
  longlong val_int_endpoint(bool left_endp, bool *incl_endp);
72
73
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
74
  bool check_valid_arguments_processor(uchar *int_arg)
 
75
  {
 
76
    return !has_date_args();
 
77
  }
73
78
};
74
79
 
75
80
 
86
91
    maybe_null=1; 
87
92
  }
88
93
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
94
  bool check_valid_arguments_processor(uchar *int_arg)
 
95
  {
 
96
    return !has_date_args();
 
97
  }
89
98
};
90
99
 
91
100
 
98
107
  { DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
99
108
  String *val_str(String *str) 
100
109
  {
101
 
    str->set(val_int(), &my_charset_bin);
102
 
    return null_value ? 0 : str;
 
110
    longlong nr= val_int();
 
111
    if (null_value)
 
112
      return 0;
 
113
    str->set(nr, &my_charset_bin);
 
114
    return str;
103
115
  }
104
116
  const char *func_name() const { return "month"; }
105
117
  enum Item_result result_type () const { return INT_RESULT; }
111
123
    maybe_null=1; 
112
124
  }
113
125
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
126
  bool check_valid_arguments_processor(uchar *int_arg)
 
127
  {
 
128
    return !has_date_args();
 
129
  }
114
130
};
115
131
 
116
132
 
140
156
    maybe_null=1; 
141
157
  }
142
158
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
159
  bool check_valid_arguments_processor(uchar *int_arg)
 
160
  {
 
161
    return !has_date_args();
 
162
  }
143
163
};
144
164
 
145
165
 
156
176
    maybe_null=1;
157
177
  }
158
178
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
179
  bool check_valid_arguments_processor(uchar *int_arg)
 
180
  {
 
181
    return !has_time_args();
 
182
  }
159
183
};
160
184
 
161
185
 
172
196
    maybe_null=1;
173
197
  }
174
198
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
199
  bool check_valid_arguments_processor(uchar *int_arg)
 
200
  {
 
201
    return !has_time_args();
 
202
  }
175
203
};
176
204
 
177
205
 
188
216
     maybe_null=1;
189
217
  }
190
218
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
219
  bool check_valid_arguments_processor(uchar *int_arg)
 
220
  {
 
221
    return !has_date_args();
 
222
  }
191
223
};
192
224
 
193
225
 
204
236
    maybe_null=1;
205
237
  }
206
238
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
239
  bool check_valid_arguments_processor(uchar *int_arg)
 
240
  {
 
241
    return !has_time_args();
 
242
  }
207
243
};
208
244
 
209
245
 
234
270
    maybe_null=1;
235
271
  }
236
272
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
273
  bool check_valid_arguments_processor(uchar *int_arg)
 
274
  {
 
275
    return !has_date_args();
 
276
  }
237
277
};
238
278
 
239
279
 
252
292
    maybe_null=1;
253
293
  }
254
294
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
295
  bool check_valid_arguments_processor(uchar *int_arg)
 
296
  {
 
297
    return !has_date_args();
 
298
  }
255
299
};
256
300
 
257
301
 
282
326
    maybe_null=1;
283
327
  }
284
328
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
329
  bool check_valid_arguments_processor(uchar *int_arg)
 
330
  {
 
331
    return !has_date_args();
 
332
  }
285
333
};
286
334
 
287
335
class Item_func_dayname :public Item_func_weekday
311
359
    (and thus may not be used as a partitioning function)
312
360
    when its argument is NOT of the TIMESTAMP type.
313
361
  */
314
 
  bool is_timezone_dependent_processor(uchar *int_arg)
 
362
  bool check_valid_arguments_processor(uchar *int_arg)
315
363
  {
316
364
    return !has_timestamp_args();
317
365
  }
336
384
    max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
337
385
  }
338
386
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
387
  bool check_valid_arguments_processor(uchar *int_arg)
 
388
  {
 
389
    return !has_time_args();
 
390
  }
339
391
};
340
392
 
341
393
 
589
641
  const char *func_name() const { return "from_days"; }
590
642
  bool get_date(MYSQL_TIME *res, uint fuzzy_date);
591
643
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
644
  bool check_valid_arguments_processor(uchar *int_arg)
 
645
  {
 
646
    return has_date_args() || has_time_args();
 
647
  }
592
648
};
593
649
 
594
650
 
715
771
  bool eq(const Item *item, bool binary_cmp) const;
716
772
  virtual void print(String *str, enum_query_type query_type);
717
773
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
774
  bool check_valid_arguments_processor(uchar *int_arg)
 
775
  {
 
776
    switch (int_type) {
 
777
    case INTERVAL_YEAR:
 
778
    case INTERVAL_YEAR_MONTH:
 
779
    case INTERVAL_QUARTER:
 
780
    case INTERVAL_MONTH:
 
781
    /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
 
782
    case INTERVAL_DAY:
 
783
      return !has_date_args();
 
784
    case INTERVAL_DAY_HOUR:
 
785
    case INTERVAL_DAY_MINUTE:
 
786
    case INTERVAL_DAY_SECOND:
 
787
    case INTERVAL_DAY_MICROSECOND:
 
788
      return !has_datetime_args();
 
789
    case INTERVAL_HOUR:
 
790
    case INTERVAL_HOUR_MINUTE:
 
791
    case INTERVAL_HOUR_SECOND:
 
792
    case INTERVAL_MINUTE:
 
793
    case INTERVAL_MINUTE_SECOND:
 
794
    case INTERVAL_SECOND:
 
795
    case INTERVAL_MICROSECOND:
 
796
    case INTERVAL_HOUR_MICROSECOND:
 
797
    case INTERVAL_MINUTE_MICROSECOND:
 
798
    case INTERVAL_SECOND_MICROSECOND:
 
799
      return !has_time_args();
 
800
    default:
 
801
      /*
 
802
        INTERVAL_LAST is only an end marker,
 
803
        INTERVAL_WEEK depends on default_week_format which is a session
 
804
        variable and cannot be used for partitioning. See bug#57071.
 
805
      */
 
806
      break;
 
807
    }
 
808
    return true;
 
809
  }
718
810
};
719
811
 
720
812
 
965
1057
    maybe_null=1;
966
1058
  }
967
1059
  bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
 
1060
  bool check_valid_arguments_processor(uchar *int_arg)
 
1061
  {
 
1062
    return !has_time_args();
 
1063
  }
968
1064
};
969
1065
 
970
1066