MySQL 8.4.0
Source Code Documentation
item_timefunc.h
Go to the documentation of this file.
1#ifndef ITEM_TIMEFUNC_INCLUDED
2#define ITEM_TIMEFUNC_INCLUDED
3
4/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27/* Function items used by mysql */
28
29#include <assert.h>
30#include <sys/types.h>
31
32#include <algorithm>
33#include <cstddef>
34
35#include "field_types.h" // MYSQL_TYPE_DATETIME
36
37#include "my_inttypes.h"
38#include "my_table_map.h"
39#include "my_time.h"
42#include "mysql_time.h"
43#include "sql/enum_query_type.h"
44#include "sql/field.h"
45#include "sql/item.h"
46#include "sql/item_func.h"
47#include "sql/item_strfunc.h" // Item_str_func
48#include "sql/parse_location.h" // POS
49#include "sql/set_var.h"
50#include "sql/sql_const.h"
51#include "sql_string.h"
52#include "template_utils.h" // pointer_cast
53
54class MY_LOCALE;
55class PT_item_list;
56class THD;
57class Time_zone;
58class my_decimal;
59struct Date_time_format;
60struct Parse_context;
61struct TABLE;
62
63bool get_interval_value(Item *args, interval_type int_type, String *str_value,
65
66class Item_func_period_add final : public Item_int_func {
67 public:
68 Item_func_period_add(const POS &pos, Item *a, Item *b)
69 : Item_int_func(pos, a, b) {}
70 longlong val_int() override;
71 const char *func_name() const override { return "period_add"; }
72 enum Functype functype() const override { return PERIODADD_FUNC; }
73 bool resolve_type(THD *thd) override;
74};
75
77 public:
78 Item_func_period_diff(const POS &pos, Item *a, Item *b)
79 : Item_int_func(pos, a, b) {}
80 longlong val_int() override;
81 const char *func_name() const override { return "period_diff"; }
82 enum Functype functype() const override { return PERIODDIFF_FUNC; }
83 bool resolve_type(THD *thd) override;
84};
85
86class Item_func_to_days final : public Item_int_func {
87 public:
88 Item_func_to_days(const POS &pos, Item *a) : Item_int_func(pos, a) {}
89 longlong val_int() override;
90 const char *func_name() const override { return "to_days"; }
91 enum Functype functype() const override { return TO_DAYS_FUNC; }
92 bool resolve_type(THD *thd) override;
94 longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
95 bool check_partition_func_processor(uchar *) override { return false; }
97 return !has_date_args();
98 }
99};
100
102 public:
103 Item_func_to_seconds(const POS &pos, Item *a) : Item_int_func(pos, a) {}
104 longlong val_int() override;
105 const char *func_name() const override { return "to_seconds"; }
106 enum Functype functype() const override { return TO_SECONDS_FUNC; }
107 bool resolve_type(THD *thd) override;
109 longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
110 bool check_partition_func_processor(uchar *) override { return false; }
111
112 bool intro_version(uchar *int_arg) override {
113 int *input_version = (int *)int_arg;
114 /* This function was introduced in 5.5 */
115 int output_version = std::max(*input_version, 50500);
116 *input_version = output_version;
117 return false;
118 }
119
120 /* Only meaningful with date part and optional time part */
122 return !has_date_args();
123 }
124};
125
127 public:
128 Item_func_dayofmonth(const POS &pos, Item *a) : Item_int_func(pos, a) {}
129
130 longlong val_int() override;
131 const char *func_name() const override { return "dayofmonth"; }
132 enum Functype functype() const override { return DAY_FUNC; }
133 bool resolve_type(THD *thd) override;
134 bool check_partition_func_processor(uchar *) override { return false; }
136 return !has_date_args();
137 }
138};
139
140/**
141 TS-TODO: This should probably have Item_int_func as parent class.
142*/
143class Item_func_month final : public Item_func {
144 public:
145 Item_func_month(const POS &pos, Item *a) : Item_func(pos, a) {
148 }
149 longlong val_int() override;
150 double val_real() override {
151 assert(fixed);
152 return (double)Item_func_month::val_int();
153 }
154 String *val_str(String *str) override {
155 const longlong nr = val_int();
156 if (null_value) return nullptr;
157 str->set(nr, collation.collation);
158 return str;
159 }
160 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
161 return get_date_from_int(ltime, fuzzydate);
162 }
163 bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
164 const char *func_name() const override { return "month"; }
165 enum Functype functype() const override { return MONTH_FUNC; }
166 enum Item_result result_type() const override { return INT_RESULT; }
167 bool resolve_type(THD *thd) override;
168 bool check_partition_func_processor(uchar *) override { return false; }
170 return !has_date_args();
171 }
172};
173
174class Item_func_monthname final : public Item_str_func {
176
177 public:
178 Item_func_monthname(const POS &pos, Item *a) : Item_str_func(pos, a) {}
179 const char *func_name() const override { return "monthname"; }
180 enum Functype functype() const override { return MONTHNAME_FUNC; }
181 String *val_str(String *str) override;
182 bool resolve_type(THD *thd) override;
183 bool check_partition_func_processor(uchar *) override { return true; }
185 return !has_date_args();
186 }
187};
188
189class Item_func_dayofyear final : public Item_int_func {
190 public:
191 Item_func_dayofyear(const POS &pos, Item *a) : Item_int_func(pos, a) {}
192 longlong val_int() override;
193 const char *func_name() const override { return "dayofyear"; }
194 enum Functype functype() const override { return DAYOFYEAR_FUNC; }
195 bool resolve_type(THD *thd) override;
196 bool check_partition_func_processor(uchar *) override { return false; }
198 return !has_date_args();
199 }
200};
201
202class Item_func_hour final : public Item_int_func {
203 public:
204 Item_func_hour(const POS &pos, Item *a) : Item_int_func(pos, a) {}
205 longlong val_int() override;
206 const char *func_name() const override { return "hour"; }
207 enum Functype functype() const override { return HOUR_FUNC; }
208 bool resolve_type(THD *thd) override;
209 bool check_partition_func_processor(uchar *) override { return false; }
211 return !has_time_args();
212 }
213};
214
215class Item_func_minute final : public Item_int_func {
216 public:
217 Item_func_minute(const POS &pos, Item *a) : Item_int_func(pos, a) {}
218 longlong val_int() override;
219 const char *func_name() const override { return "minute"; }
220 enum Functype functype() const override { return MINUTE_FUNC; }
221 bool resolve_type(THD *thd) override;
222 bool check_partition_func_processor(uchar *) override { return false; }
224 return !has_time_args();
225 }
226};
227
228class Item_func_quarter final : public Item_int_func {
229 public:
230 Item_func_quarter(const POS &pos, Item *a) : Item_int_func(pos, a) {}
231 longlong val_int() override;
232 const char *func_name() const override { return "quarter"; }
233 enum Functype functype() const override { return QUARTER_FUNC; }
234 bool resolve_type(THD *thd) override;
235 bool check_partition_func_processor(uchar *) override { return false; }
237 return !has_date_args();
238 }
239};
240
241class Item_func_second final : public Item_int_func {
242 public:
243 Item_func_second(const POS &pos, Item *a) : Item_int_func(pos, a) {}
244 longlong val_int() override;
245 const char *func_name() const override { return "second"; }
246 enum Functype functype() const override { return SECOND_FUNC; }
247 bool resolve_type(THD *thd) override;
248 bool check_partition_func_processor(uchar *) override { return false; }
250 return !has_time_args();
251 }
252};
253
254class Item_func_week final : public Item_int_func {
256
257 public:
259 Item_func_week(const POS &pos, Item *a, Item *b) : super(pos, a, b) {}
260
261 bool do_itemize(Parse_context *pc, Item **res) override;
262
263 longlong val_int() override;
264 const char *func_name() const override { return "week"; }
265 enum Functype functype() const override { return WEEK_FUNC; }
266 bool resolve_type(THD *thd) override;
267};
268
269class Item_func_yearweek final : public Item_int_func {
270 public:
271 Item_func_yearweek(const POS &pos, Item *a, Item *b)
272 : Item_int_func(pos, a, b) {}
273 longlong val_int() override;
274 const char *func_name() const override { return "yearweek"; }
275 enum Functype functype() const override { return YEARWEEK_FUNC; }
276 bool resolve_type(THD *thd) override;
277 bool check_partition_func_processor(uchar *) override { return false; }
279 return !has_date_args();
280 }
281};
282
283class Item_func_year final : public Item_int_func {
284 public:
285 Item_func_year(const POS &pos, Item *a) : Item_int_func(pos, a) {}
286 longlong val_int() override;
287 const char *func_name() const override { return "year"; }
288 enum Functype functype() const override { return YEAR_FUNC; }
290 longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
291 bool resolve_type(THD *thd) override;
292 bool check_partition_func_processor(uchar *) override { return false; }
294 return !has_date_args();
295 }
296};
297
298class Item_typecast_year final : public Item_int_func {
299 public:
300 Item_typecast_year(const POS &pos, Item *a) : Item_int_func(pos, a) {
302 }
303 longlong val_int() override;
304 const char *func_name() const override { return "cast_as_year"; }
305 enum Functype functype() const override { return TYPECAST_FUNC; }
306 bool resolve_type(THD *thd) override;
307 void print(const THD *thd, String *str,
308 enum_query_type query_type) const override;
309};
310
311/**
312 TS-TODO: This should probably have Item_int_func as parent class.
313*/
316
317 public:
318 Item_func_weekday(const POS &pos, Item *a, bool type_arg)
319 : Item_func(pos, a), odbc_type(type_arg) {
322 }
323 longlong val_int() override;
324 double val_real() override {
325 assert(fixed);
326 return static_cast<double>(val_int());
327 }
328 String *val_str(String *str) override {
329 assert(fixed);
330 str->set(val_int(), &my_charset_bin);
331 return null_value ? nullptr : str;
332 }
333 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
334 return get_date_from_int(ltime, fuzzydate);
335 }
336 bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
337 const char *func_name() const override {
338 return (odbc_type ? "dayofweek" : "weekday");
339 }
340 enum Functype functype() const override { return WEEKDAY_FUNC; }
341 enum Item_result result_type() const override { return INT_RESULT; }
342 bool resolve_type(THD *thd) override;
343 bool check_partition_func_processor(uchar *) override { return false; }
345 return !has_date_args();
346 }
347};
348
349/**
350 TS-TODO: Item_func_dayname should be derived from Item_str_func.
351 In the current implementation funny things can happen:
352 select dayname(now())+1 -> 4
353*/
356
357 public:
358 Item_func_dayname(const POS &pos, Item *a)
359 : Item_func_weekday(pos, a, false) {}
360 const char *func_name() const override { return "dayname"; }
361 enum Functype functype() const override { return DAYNAME_FUNC; }
362 String *val_str(String *str) override;
363 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
364 return get_date_from_string(ltime, fuzzydate);
365 }
366 bool get_time(MYSQL_TIME *ltime) override {
367 return get_time_from_string(ltime);
368 }
369 enum Item_result result_type() const override { return STRING_RESULT; }
370 bool resolve_type(THD *thd) override;
371 bool check_partition_func_processor(uchar *) override { return true; }
372};
373
374/*
375 Abstract class for functions returning "struct timeval".
376*/
378 public:
379 explicit Item_timeval_func(const POS &pos) : Item_func(pos) {}
380
382 Item_timeval_func(const POS &pos, Item *a) : Item_func(pos, a) {}
383 /**
384 Return timestamp in "struct timeval" format.
385 @param[out] tm The value is store here.
386 @retval false On success
387 @retval true On error
388 */
389 virtual bool val_timeval(my_timeval *tm) = 0;
390 longlong val_int() override;
391 double val_real() override;
392 String *val_str(String *str) override;
393 my_decimal *val_decimal(my_decimal *decimal_value) override;
394 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
395 return get_date_from_numeric(ltime, fuzzydate);
396 }
397 bool get_time(MYSQL_TIME *ltime) override {
398 return get_time_from_numeric(ltime);
399 }
400 enum Item_result result_type() const override {
402 }
403};
404
407
408 public:
409 explicit Item_func_unix_timestamp(const POS &pos) : Item_timeval_func(pos) {}
410
412
414 : Item_timeval_func(pos, a) {}
415
416 const char *func_name() const override { return "unix_timestamp"; }
417 enum Functype functype() const override { return UNIX_TIMESTAMP_FUNC; }
418
419 bool do_itemize(Parse_context *pc, Item **res) override;
421 longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
422 bool check_partition_func_processor(uchar *) override { return false; }
423 /*
424 UNIX_TIMESTAMP() depends on the current timezone
425 (and thus may not be used as a partitioning function)
426 when its argument is NOT of the TIMESTAMP type.
427 */
429 return !has_timestamp_args();
430 }
431
433 if (arg_count == 0) return INNER_TABLE_BIT;
434 return 0;
435 }
436
437 bool resolve_type(THD *thd) override {
438 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_DATETIME)) return true;
440 const uint8 dec = arg_count == 0 ? 0 : args[0]->datetime_precision();
441 if (dec > 0) {
443 } else {
445 }
446 return false;
447 }
448 bool val_timeval(my_timeval *tm) override;
449
451 /*
452 TODO: Allow UNIX_TIMESTAMP called with an argument to be a part
453 of the expression for a generated column too.
454 */
456 pointer_cast<Check_function_as_value_generator_parameters *>(p_arg);
457 func_arg->banned_function_name = func_name();
458 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
459 (func_arg->source == VGS_CHECK_CONSTRAINT));
460 }
461};
462
464 public:
465 Item_func_time_to_sec(const POS &pos, Item *item)
466 : Item_int_func(pos, item) {}
467 longlong val_int() override;
468 const char *func_name() const override { return "time_to_sec"; }
469 enum Functype functype() const override { return TIME_TO_SEC_FUNC; }
470 bool resolve_type(THD *thd) override;
471 bool check_partition_func_processor(uchar *) override { return false; }
473 return !has_time_args();
474 }
475};
476
477/**
478 Abstract class for functions returning TIME, DATE, DATETIME types
479 whose data type is known at constructor time.
480*/
482 protected:
483 bool check_precision();
484
485 protected:
486 void add_json_info(Json_object *obj) override {
487 if (decimals > 0)
488 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
489 }
490
491 public:
493 explicit Item_temporal_func(const POS &pos) : Item_func(pos) {}
494
496 Item_temporal_func(const POS &pos, Item *a) : Item_func(pos, a) {}
497
498 Item_temporal_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {}
499
500 Item_temporal_func(Item *a, Item *b, Item *c) : Item_func(a, b, c) {}
501 Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c)
502 : Item_func(pos, a, b, c) {}
503 Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
504 : Item_func(pos, a, b, c, d) {}
506 : Item_func(pos, list) {}
507
508 Item_result result_type() const override { return STRING_RESULT; }
510 return &my_charset_bin;
511 }
514 }
515 uint time_precision() override {
516 assert(fixed);
517 return decimals;
518 }
519 uint datetime_precision() override {
520 assert(fixed);
521 return decimals;
522 }
523 void print(const THD *thd, String *str,
524 enum_query_type query_type) const override;
525};
526
527/**
528 Abstract class for functions returning TIME, DATE, DATETIME or string values,
529 whose data type depends on parameters and is set at fix_field time.
530*/
532 protected:
533 sql_mode_t sql_mode; // sql_mode value is cached here in resolve_type()
534 String ascii_buf; // Conversion buffer
535 /**
536 Get "native" temporal value as MYSQL_TIME
537 @param[out] ltime The value is stored here.
538 @param[in] fuzzy_date Date flags.
539 @retval false On success.
540 @retval true On error.
541 */
542 virtual bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) = 0;
544 bool no_conversions) override;
545 void add_json_info(Json_object *obj) override {
547 }
548
549 public:
551 : Item_str_func(a, b), sql_mode(0) {}
553 : Item_str_func(pos, a, b), sql_mode(0) {}
554
555 Item_result result_type() const override { return STRING_RESULT; }
557 /*
558 Can return TIME, DATE, DATETIME or VARCHAR depending on arguments.
559 Send using "binary" when TIME, DATE or DATETIME,
560 or using collation.collation when VARCHAR
561 (which is fixed from @collation_connection in resolve_type()).
562 */
563 assert(fixed);
566 }
569 }
570 longlong val_int() override { return val_int_from_decimal(); }
571 double val_real() override { return val_real_from_decimal(); }
572 my_decimal *val_decimal(my_decimal *decimal_value) override;
573 /**
574 Return string value in ASCII character set.
575 */
576 String *val_str_ascii(String *str) override;
577 /**
578 Return string value in @@character_set_connection.
579 */
580 String *val_str(String *str) override {
582 }
583 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
584 bool get_time(MYSQL_TIME *ltime) override;
585};
586
587/*
588 This can't be a Item_str_func, because the val_real() functions are special
589*/
590
591/**
592 Abstract class for functions returning DATE values.
593*/
595 protected:
597 return save_date_in_field(field);
598 }
599
600 public:
602 explicit Item_date_func(const POS &pos) : Item_temporal_func(pos) {
604 }
606 Item_date_func(const POS &pos, Item *a) : Item_temporal_func(pos, a) {
608 }
609 Item_date_func(const POS &pos, Item *a, Item *b)
610 : Item_temporal_func(pos, a, b) {
612 }
613 bool get_time(MYSQL_TIME *ltime) override {
614 return get_time_from_date(ltime);
615 }
617 longlong val_int() override { return val_int_from_date(); }
618 longlong val_date_temporal() override;
619 double val_real() override { return static_cast<double>(val_int()); }
620 const char *func_name() const override { return "date"; }
621 enum Functype functype() const override { return DATE_FUNC; }
622 bool resolve_type(THD *) override { return false; }
623 my_decimal *val_decimal(my_decimal *decimal_value) override {
624 assert(fixed);
625 return val_decimal_from_date(decimal_value);
626 }
627 // All date functions must implement get_date()
628 // to avoid use of generic Item::get_date()
629 // which converts to string and then parses the string as DATE.
630 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override = 0;
631};
632
633/**
634 Abstract class for functions returning DATETIME values.
635*/
637 protected:
639 return save_date_in_field(field);
640 }
641
642 public:
645 }
648 }
651 }
652 Item_datetime_func(const POS &pos, Item *a) : Item_temporal_func(pos, a) {
654 }
655 Item_datetime_func(const POS &pos, Item *a, Item *b)
656 : Item_temporal_func(pos, a, b) {
658 }
661 }
662 Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c)
663 : Item_temporal_func(pos, a, b, c) {
665 }
666 Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
667 : Item_temporal_func(pos, a, b, c, d) {
669 }
671 : Item_temporal_func(pos, list) {
673 }
674
675 double val_real() override { return val_real_from_decimal(); }
676 String *val_str(String *str) override {
678 }
679 longlong val_int() override { return val_int_from_datetime(); }
680 longlong val_date_temporal() override;
681 my_decimal *val_decimal(my_decimal *decimal_value) override {
682 assert(fixed);
683 return val_decimal_from_date(decimal_value);
684 }
685 bool get_time(MYSQL_TIME *ltime) override {
686 return get_time_from_datetime(ltime);
687 }
688 // All datetime functions must implement get_date()
689 // to avoid use of generic Item::get_date()
690 // which converts to string and then parses the string as DATETIME.
691 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override = 0;
692};
693
694/**
695 Abstract class for functions returning TIME values.
696*/
698 protected:
700 return save_time_in_field(field);
701 }
702
703 public:
705 explicit Item_time_func(const POS &pos) : Item_temporal_func(pos) {
707 }
710 }
711 Item_time_func(const POS &pos, Item *a) : Item_temporal_func(pos, a) {
713 }
714 Item_time_func(const POS &pos, Item *a, Item *b)
715 : Item_temporal_func(pos, a, b) {
717 }
718 Item_time_func(const POS &pos, Item *a, Item *b, Item *c)
719 : Item_temporal_func(pos, a, b, c) {
721 }
722 double val_real() override { return val_real_from_decimal(); }
723 my_decimal *val_decimal(my_decimal *decimal_value) override {
724 assert(fixed);
725 return val_decimal_from_time(decimal_value);
726 }
727 longlong val_int() override { return val_int_from_time(); }
728 longlong val_time_temporal() override;
729 bool get_date(MYSQL_TIME *res, my_time_flags_t) override {
730 return get_date_from_time(res);
731 }
733 // All time functions must implement get_time()
734 // to avoid use of generic Item::get_time()
735 // which converts to string and then parses the string as TIME.
736 bool get_time(MYSQL_TIME *res) override = 0;
737};
738
739/**
740 Cache for MYSQL_TIME value with various representations.
741
742 - MYSQL_TIME representation (time) is initialized during set_XXX().
743 - Packed representation (time_packed) is also initialized during set_XXX().
744 - String representation (string_buff) is also initialized during set_XXX();
745*/
747 MYSQL_TIME time; ///< MYSQL_TIME representation
748 longlong time_packed; ///< packed representation
749 char string_buff[MAX_DATE_STRING_REP_LENGTH]; ///< string representation
750 uint string_length; ///< length of string
751 uint8 dec; ///< Number of decimals
752
753 /**
754 Store MYSQL_TIME representation into the given MYSQL_TIME variable.
755 */
756 void get_TIME(MYSQL_TIME *ltime) const {
758 *ltime = time;
759 }
760
761 public:
764 string_buff[0] = '\0';
765 }
766 /**
767 Set time and time_packed from a DATE value.
768 */
769 void set_date(MYSQL_TIME *ltime);
770 /**
771 Set time and time_packed from a TIME value.
772 */
773 void set_time(MYSQL_TIME *ltime, uint8 dec_arg);
774 /**
775 Set time and time_packed from a DATETIME value.
776 */
777 void set_datetime(MYSQL_TIME *ltime, uint8 dec_arg,
778 const Time_zone *tz = nullptr);
779 /**
780 Set time and time_packed according to DATE value
781 in "struct timeval" representation and its time zone.
782 */
783 void set_date(my_timeval tv, Time_zone *tz);
784 /**
785 Set time and time_packed according to TIME value
786 in "struct timeval" representation and its time zone.
787 */
788 void set_time(my_timeval tv, uint8 dec_arg, Time_zone *tz);
789 /**
790 Set time and time_packed according to DATETIME value
791 in "struct timeval" representation and its time zone.
792 */
793 void set_datetime(my_timeval tv, uint8 dec_arg, Time_zone *tz);
794 /**
795 Test if cached value is equal to another MYSQL_TIME_cache value.
796 */
797 bool eq(const MYSQL_TIME_cache &tm) const {
798 return val_packed() == tm.val_packed();
799 }
800
801 /**
802 Return number of decimal digits.
803 */
804 uint8 decimals() const {
806 return dec;
807 }
808
809 /**
810 Return packed representation.
811 */
814 return time_packed;
815 }
816 /**
817 Store MYSQL_TIME representation into the given date/datetime variable
818 checking date flags.
819 */
820 bool get_date(MYSQL_TIME *ltime, uint fuzzyflags) const;
821 /**
822 Store MYSQL_TIME representation into the given time variable.
823 */
824 bool get_time(MYSQL_TIME *ltime) const {
825 get_TIME(ltime);
826 return false;
827 }
828 /**
829 Return pointer to MYSQL_TIME representation.
830 */
833 return &time;
834 }
835 /**
836 Store string representation into String.
837 */
839 /**
840 Return C string representation.
841 */
842 const char *cptr() const { return string_buff; }
843};
844
845/**
846 DATE'2010-01-01'
847*/
848class Item_date_literal final : public Item_date_func {
850
851 public:
852 /**
853 Constructor for Item_date_literal.
854 @param ltime DATE value.
855 */
857 cached_time.set_date(ltime);
859 fixed = true;
860 }
861 const char *func_name() const override { return "date_literal"; }
862 void print(const THD *thd, String *str,
863 enum_query_type query_type) const override;
865 assert(fixed);
866 return cached_time.val_packed();
867 }
868 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override {
869 assert(fixed);
870 return cached_time.get_date(ltime, fuzzy_date);
871 }
872 String *val_str(String *str) override {
873 assert(fixed);
874 return cached_time.val_str(str);
875 }
876 bool resolve_type(THD *) override { return false; }
877 bool check_partition_func_processor(uchar *) override { return false; }
878 bool basic_const_item() const override { return true; }
879 table_map used_tables() const override { return 0; }
880 table_map not_null_tables() const override { return used_tables(); }
881 void cleanup() override { assert(marker == MARKER_NONE); }
882 bool eq(const Item *item, bool binary_cmp) const override;
883};
884
885/**
886 TIME'10:10:10'
887*/
888class Item_time_literal final : public Item_time_func {
890
891 public:
892 /**
893 Constructor for Item_time_literal.
894 @param ltime TIME value.
895 @param dec_arg number of fractional digits in ltime.
896 */
897 Item_time_literal(MYSQL_TIME *ltime, uint dec_arg) {
898 set_data_type_time(std::min(dec_arg, uint(DATETIME_MAX_DECIMALS)));
900 fixed = true;
901 }
902 const char *func_name() const override { return "time_literal"; }
903 void print(const THD *thd, String *str,
904 enum_query_type query_type) const override;
906 assert(fixed);
907 return cached_time.val_packed();
908 }
909 bool get_time(MYSQL_TIME *ltime) override {
910 assert(fixed);
911 return cached_time.get_time(ltime);
912 }
913 String *val_str(String *str) override {
914 assert(fixed);
915 return cached_time.val_str(str);
916 }
917 bool resolve_type(THD *) override { return false; }
918 bool check_partition_func_processor(uchar *) override { return false; }
919 bool basic_const_item() const override { return true; }
920 table_map used_tables() const override { return 0; }
921 table_map not_null_tables() const override { return used_tables(); }
922 void cleanup() override { assert(marker == MARKER_NONE); }
923 bool eq(const Item *item, bool binary_cmp) const override;
924};
925
926/**
927 TIMESTAMP'2001-01-01 10:20:30'
928*/
931
932 public:
933 /**
934 Constructor for Item_datetime_literal.
935 @param ltime DATETIME value.
936 @param dec_arg Number of fractional digits in ltime.
937 @param tz The current time zone, used for converting literals with
938 time zone upon storage.
939 */
940 Item_datetime_literal(MYSQL_TIME *ltime, uint dec_arg, const Time_zone *tz) {
941 set_data_type_datetime(std::min(dec_arg, uint{DATETIME_MAX_DECIMALS}));
943 fixed = true;
944 }
945 const char *func_name() const override { return "datetime_literal"; }
946 enum Functype functype() const override { return DATETIME_LITERAL; }
947 void print(const THD *thd, String *str,
948 enum_query_type query_type) const override;
950 assert(fixed);
951 return cached_time.val_packed();
952 }
953 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override {
954 assert(fixed);
955 return cached_time.get_date(ltime, fuzzy_date);
956 }
957 String *val_str(String *str) override {
958 assert(fixed);
959 return cached_time.val_str(str);
960 }
961 bool resolve_type(THD *) override { return false; }
962 bool check_partition_func_processor(uchar *) override { return false; }
963 bool basic_const_item() const override { return true; }
964 table_map used_tables() const override { return 0; }
965 table_map not_null_tables() const override { return used_tables(); }
966 void cleanup() override { assert(marker == MARKER_NONE); }
967 bool eq(const Item *item, bool binary_cmp) const override;
968};
969
970/**
971 This function implements the `AT TIME ZONE` operator, which casts a temporal
972 value to a temporal with time zone.
973
974 This function is hidden from the user except when used in a cast() operation,
975 the reason being that it adds time zone information to a temporal value, and
976 we don't currently have a type that corresponds to such a value. Hence the
977 only way to evaluate this function is by a concomitant cast to a temporal
978 without time zone designation. However, the value is not converted according
979 to the current time zone as is normally the case. For `TIMESTAMP`, this means
980 that the value is converted to the time zone given as argument to this
981 function rather than the session's time zone. And as we currently only support
982 the UTC time zone or the equivalent `INTERVAL '+00:00'`, so in practice the
983 value is not converted at all. This is a bit similar to the unix_timestamp()
984 function, but that one converts any argument (DATETIME, TIME) to UTC from the
985 session's time zone. This operator only accepts `TIMESTAMP` values.
986*/
988 public:
989 Item_func_at_time_zone(const POS &pos, Item *datetime,
990 const char *specifier_string, bool is_interval)
991 : Item_datetime_func(pos, datetime),
993 m_is_interval(is_interval) {}
994
995 bool resolve_type(THD *) override;
996
997 const char *func_name() const override { return "time_zone"; }
998
999 bool set_time_zone(THD *thd);
1000
1001 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1002
1003 const char *specifier_string() const { return m_specifier_string; }
1004
1005 protected:
1006 bool check_type() const;
1007
1008 private:
1009 /// The time zone that the specifier string argument resolves to.
1010 const Time_zone *m_tz{nullptr};
1011
1012 /// The specifier string argument, not used after resolution.
1014
1015 /**
1016 Whether the syntax used the `INTERVAL` construction. We have no interval
1017 type.
1018 */
1020};
1021
1022/// Abstract CURTIME function. Children should define what time zone is used.
1025
1026 protected:
1027 // Abstract method that defines which time zone is used for conversion.
1028 virtual Time_zone *time_zone() = 0;
1029
1030 void add_json_info(Json_object *obj) override {
1031 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
1032 }
1033
1034 public:
1035 /**
1036 Constructor for Item_func_curtime.
1037 @param pos Position of token in the parser.
1038 @param dec_arg Number of fractional digits.
1039 */
1040 Item_func_curtime(const POS &pos, uint8 dec_arg) : Item_time_func(pos) {
1041 decimals = dec_arg;
1042 }
1043
1044 bool do_itemize(Parse_context *pc, Item **res) override;
1045
1046 /// This function must assign a new value for each execution
1048 return INNER_TABLE_BIT;
1049 }
1050
1051 bool resolve_type(THD *thd) override;
1052 longlong val_time_temporal() override;
1053 bool get_time(MYSQL_TIME *ltime) override;
1054 String *val_str(String *) override;
1055 bool check_function_as_value_generator(uchar *checker_args) override {
1057 pointer_cast<Check_function_as_value_generator_parameters *>(
1058 checker_args);
1059 func_arg->banned_function_name = func_name();
1060 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1061 (func_arg->source == VGS_CHECK_CONSTRAINT));
1062 }
1063};
1064
1066 protected:
1067 Time_zone *time_zone() override;
1068
1069 public:
1070 Item_func_curtime_local(const POS &pos, uint8 dec_arg)
1071 : Item_func_curtime(pos, dec_arg) {}
1072 const char *func_name() const override { return "curtime"; }
1073};
1074
1076 protected:
1077 Time_zone *time_zone() override;
1078
1079 public:
1080 Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
1081 : Item_func_curtime(pos, dec_arg) {}
1082 const char *func_name() const override { return "utc_time"; }
1083};
1084
1085/**
1086 Abstract CURDATE function.
1087
1088 @sa Item_func_curtime
1089 */
1092
1093 protected:
1094 virtual Time_zone *time_zone() = 0;
1095
1096 public:
1097 explicit Item_func_curdate(const POS &pos) : Item_date_func(pos) {}
1098
1099 bool do_itemize(Parse_context *pc, Item **res) override;
1100
1101 /// This function must assign a new value for each execution
1103 return INNER_TABLE_BIT;
1104 }
1105
1106 bool resolve_type(THD *) override;
1107 longlong val_date_temporal() override;
1108 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1109 String *val_str(String *) override;
1110 bool check_function_as_value_generator(uchar *checker_args) override {
1112 pointer_cast<Check_function_as_value_generator_parameters *>(
1113 checker_args);
1114 func_arg->banned_function_name = func_name();
1115 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1116 (func_arg->source == VGS_CHECK_CONSTRAINT));
1117 }
1118};
1119
1121 protected:
1122 Time_zone *time_zone() override;
1123
1124 public:
1125 explicit Item_func_curdate_local(const POS &pos) : Item_func_curdate(pos) {}
1126 const char *func_name() const override { return "curdate"; }
1127};
1128
1130 protected:
1131 Time_zone *time_zone() override;
1132
1133 public:
1135 const char *func_name() const override { return "utc_date"; }
1136};
1137
1138/**
1139 Abstract CURRENT_TIMESTAMP function.
1140
1141 @sa Item_func_curtime
1142*/
1144 protected:
1145 virtual Time_zone *time_zone() = 0;
1147 bool no_conversions) override;
1148
1149 void add_json_info(Json_object *obj) override {
1150 if (decimals > 0)
1151 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
1152 }
1153
1154 public:
1155 /**
1156 Constructor for Item_func_now.
1157 @param dec_arg Number of fractional digits.
1158 */
1160 Item_func_now(const POS &pos, uint8 dec_arg) : Item_datetime_func(pos) {
1161 decimals = dec_arg;
1162 }
1163
1164 /// This function must assign a new value for each execution
1166 return INNER_TABLE_BIT;
1167 }
1168
1169 bool resolve_type(THD *) override;
1170 longlong val_date_temporal() override;
1171 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1172 String *val_str(String *) override;
1173 bool check_function_as_value_generator(uchar *checker_args) override {
1175 pointer_cast<Check_function_as_value_generator_parameters *>(
1176 checker_args);
1177 func_arg->banned_function_name = func_name();
1178 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1179 (func_arg->source == VGS_CHECK_CONSTRAINT));
1180 }
1181};
1182
1184 protected:
1185 Time_zone *time_zone() override;
1186
1187 public:
1188 /**
1189 Stores the query start time in a field, truncating to the field's number
1190 of fractional second digits.
1191
1192 @param field The field to store in.
1193 */
1194 static void store_in(Field *field);
1195
1197 Item_func_now_local(const POS &pos, uint8 dec_arg)
1198 : Item_func_now(pos, dec_arg) {}
1199
1200 const char *func_name() const override { return "now"; }
1201 enum Functype functype() const override { return NOW_FUNC; }
1202};
1203
1204class Item_func_now_utc final : public Item_func_now {
1206
1207 protected:
1208 Time_zone *time_zone() override;
1209
1210 public:
1211 Item_func_now_utc(const POS &pos, uint8 dec_arg)
1212 : Item_func_now(pos, dec_arg) {}
1213
1214 bool do_itemize(Parse_context *pc, Item **res) override;
1215
1216 const char *func_name() const override { return "utc_timestamp"; }
1217};
1218
1219/**
1220 SYSDATE() is like NOW(), but always uses the real current time, not the
1221 query_start(). This matches the Oracle behavior.
1222*/
1224 public:
1226 decimals = dec_arg;
1227 }
1228 const char *func_name() const override { return "sysdate"; }
1229 bool resolve_type(THD *) override;
1230 enum Functype functype() const override { return SYSDATE_FUNC; }
1231 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1232 /**
1233 This function is non-deterministic and hence depends on the 'RAND'
1234 pseudo-table.
1235
1236 @retval Always RAND_TABLE_BIT
1237 */
1239 return RAND_TABLE_BIT;
1240 }
1241};
1242
1244 public:
1245 Item_func_from_days(const POS &pos, Item *a) : Item_date_func(pos, a) {}
1246 const char *func_name() const override { return "from_days"; }
1247 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1248 bool check_partition_func_processor(uchar *) override { return false; }
1249 enum Functype functype() const override { return FROM_DAYS_FUNC; }
1251 return has_date_args() || has_time_args();
1252 }
1253 bool resolve_type(THD *thd) override {
1254 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
1255 return Item_date_func::resolve_type(thd);
1256 }
1257};
1258
1261 const bool is_time_format;
1263
1264 public:
1266 bool is_time_format_arg = false)
1267 : Item_str_func(pos, a, b), is_time_format(is_time_format_arg) {}
1268 String *val_str(String *str) override;
1269 const char *func_name() const override {
1270 return is_time_format ? "time_format" : "date_format";
1271 }
1272 bool resolve_type(THD *thd) override;
1273 uint format_length(const String *format);
1274 bool eq(const Item *item, bool binary_cmp) const override;
1275};
1276
1278 public:
1280 : Item_datetime_func(pos, a) {}
1281 const char *func_name() const override { return "from_unixtime"; }
1282 enum Functype functype() const override { return FROM_UNIXTIME_FUNC; }
1283 bool resolve_type(THD *thd) override;
1284 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1285};
1286
1287/*
1288 This class represents CONVERT_TZ() function.
1289 The important fact about this function that it is handled in special way.
1290 When such function is met in expression time_zone system tables are added
1291 to global list of tables to open, so later those already opened and locked
1292 tables can be used during this function calculation for loading time zone
1293 descriptions.
1294*/
1296 /*
1297 If time zone parameters are constants we are caching objects that
1298 represent them (we use separate from_tz_cached/to_tz_cached members
1299 to indicate this fact, since NULL is legal value for from_tz/to_tz
1300 members.
1301 */
1304
1305 public:
1306 Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
1307 : Item_datetime_func(pos, a, b, c),
1308 from_tz_cached(false),
1309 to_tz_cached(false) {}
1310 const char *func_name() const override { return "convert_tz"; }
1311 enum Functype functype() const override { return CONVERT_TZ_FUNC; }
1312 bool resolve_type(THD *) override;
1313 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1314 void cleanup() override;
1315};
1316
1318 public:
1319 Item_func_sec_to_time(const POS &pos, Item *item)
1320 : Item_time_func(pos, item) {}
1321 bool resolve_type(THD *thd) override {
1322 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_NEWDECIMAL)) return true;
1324 std::min(args[0]->decimals, uint8{DATETIME_MAX_DECIMALS}));
1325 set_nullable(true);
1326 return false;
1327 }
1328 const char *func_name() const override { return "sec_to_time"; }
1329 enum Functype functype() const override { return SEC_TO_TIME_FUNC; }
1330 bool get_time(MYSQL_TIME *ltime) override;
1331};
1332
1333extern const char *interval_names[];
1334
1335/**
1336 Implementation class for the DATE_ADD and DATE_SUB functions.
1337 Also used for the synonym functions ADDDATE and SUBDATE.
1338*/
1341
1342 public:
1344 bool subtract)
1345 : Item_temporal_hybrid_func(pos, a, b),
1347 m_subtract(subtract) {}
1348 /**
1349 POS-less ctor for post-parse construction with implicit addition to THD's
1350 free_list (see Item::Item() no-argument ctor).
1351 */
1355 m_subtract(subtract) {}
1356 const char *func_name() const override { return "date_add_interval"; }
1357 enum Functype functype() const override { return DATEADD_FUNC; }
1358 bool resolve_type(THD *) override;
1359 bool eq(const Item *item, bool binary_cmp) const override;
1360 void print(const THD *thd, String *str,
1361 enum_query_type query_type) const override;
1363 bool is_subtract() const { return m_subtract; }
1364
1365 protected:
1366 void add_json_info(Json_object *obj) override;
1367
1368 private:
1369 bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1370 bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date);
1371 bool get_time_internal(MYSQL_TIME *res);
1372
1373 /// The type of the interval argument
1375 /// False if function is DATE_ADD, true if function is DATE_SUB
1376 const bool m_subtract;
1378};
1379
1380class Item_extract final : public Item_int_func {
1382
1383 public:
1384 const interval_type int_type; // keep it public
1385 Item_extract(const POS &pos, interval_type type_arg, Item *a)
1386 : Item_int_func(pos, a), int_type(type_arg) {}
1387 longlong val_int() override;
1388 enum Functype functype() const override { return EXTRACT_FUNC; }
1389 const char *func_name() const override { return "extract"; }
1390 bool resolve_type(THD *) override;
1391 bool eq(const Item *item, bool binary_cmp) const override;
1392 void print(const THD *thd, String *str,
1393 enum_query_type query_type) const override;
1394 bool check_partition_func_processor(uchar *) override { return false; }
1396 switch (int_type) {
1397 case INTERVAL_YEAR:
1399 case INTERVAL_QUARTER:
1400 case INTERVAL_MONTH:
1401 /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
1402 case INTERVAL_DAY:
1403 return !has_date_args();
1404 case INTERVAL_DAY_HOUR:
1408 return !has_datetime_args();
1409 case INTERVAL_HOUR:
1412 case INTERVAL_MINUTE:
1414 case INTERVAL_SECOND:
1419 return !has_time_args();
1420 default:
1421 /*
1422 INTERVAL_LAST is only an end marker,
1423 INTERVAL_WEEK depends on default_week_format which is a session
1424 variable and cannot be used for partitioning. See bug#57071.
1425 */
1426 break;
1427 }
1428 return true;
1429 }
1430};
1431
1434
1435 public:
1436 Item_typecast_date(Item *a, bool explicit_cast)
1437 : Item_date_func(a), m_explicit_cast(explicit_cast) {
1438 set_nullable(true);
1439 }
1440 Item_typecast_date(const POS &pos, Item *a) : Item_date_func(pos, a) {
1441 set_nullable(true);
1442 }
1443
1444 bool resolve_type(THD *thd) override {
1445 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATE, false, true)) return true;
1446 return Item_date_func::resolve_type(thd);
1447 }
1448 void print(const THD *thd, String *str,
1449 enum_query_type query_type) const override;
1450 const char *func_name() const override { return "cast_as_date"; }
1451 enum Functype functype() const override { return TYPECAST_FUNC; }
1452 bool is_explicit_cast() const { return m_explicit_cast; }
1453 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1454 const char *cast_type() const { return "date"; }
1455};
1456
1460
1461 public:
1464 }
1465 Item_typecast_time(const POS &pos, Item *a) : Item_time_func(pos, a) {
1467 }
1468 Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
1469 : Item_time_func(pos, a) {
1471 decimals = dec_arg;
1472 }
1475 decimals = dec_arg;
1476 }
1477 void print(const THD *thd, String *str,
1478 enum_query_type query_type) const override;
1479 const char *func_name() const override { return "cast_as_time"; }
1480 enum Functype functype() const override { return TYPECAST_FUNC; }
1481 bool is_explicit_cast() const { return m_explicit_cast; }
1482 bool get_time(MYSQL_TIME *ltime) override;
1483 const char *cast_type() const { return "time"; }
1484 bool resolve_type(THD *thd) override {
1485 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATETIME, false, true))
1486 return true;
1488 : decimals);
1489 set_nullable(true);
1490 return false;
1491 }
1492};
1493
1497
1498 public:
1499 Item_typecast_datetime(Item *a, bool explicit_cast)
1500 : Item_datetime_func(a), m_explicit_cast(explicit_cast) {
1502 }
1505 }
1506 Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
1507 : Item_datetime_func(pos, a) {
1509 decimals = dec_arg;
1510 }
1513 decimals = dec_arg;
1514 }
1515 void print(const THD *thd, String *str,
1516 enum_query_type query_type) const override;
1517 const char *func_name() const override { return "cast_as_datetime"; }
1518 enum Functype functype() const override { return TYPECAST_FUNC; }
1519 const char *cast_type() const { return "datetime"; }
1520 bool is_explicit_cast() const { return m_explicit_cast; }
1521 bool resolve_type(THD *thd) override {
1522 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATETIME, false, true))
1523 return true;
1526 set_nullable(true);
1527 return false;
1528 }
1529 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1530};
1531
1533 public:
1534 Item_func_makedate(const POS &pos, Item *a, Item *b)
1535 : Item_date_func(pos, a, b) {
1536 set_nullable(true);
1537 }
1538 const char *func_name() const override { return "makedate"; }
1539 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1540 enum Functype functype() const override { return MAKEDATE_FUNC; }
1541 bool resolve_type(THD *thd) override {
1542 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_LONGLONG)) return true;
1543 return Item_date_func::resolve_type(thd);
1544 }
1545};
1546
1547/**
1548 Add a time expression to a temporal expression, or
1549 subtract a time expression from a temporal expression.
1550 Used to implement the functions ADDTIME and SUBTIME, and the
1551 two-argument version of TIMESTAMP (which sets m_datetime = true).
1552*/
1554 const bool m_datetime; ///< True if first argument expected to be datetime
1555 int m_sign; ///< +1 for ADD, -1 for SUBTRACT
1556
1557 bool val_datetime(MYSQL_TIME *time, my_time_flags_t fuzzy_date) override;
1558
1559 public:
1560 Item_func_add_time(Item *a, Item *b, bool datetime, bool negate)
1562 m_datetime(datetime),
1563 m_sign(negate ? -1 : 1) {}
1564 Item_func_add_time(const POS &pos, Item *a, Item *b, bool datetime,
1565 bool negate)
1566 : Item_temporal_hybrid_func(pos, a, b),
1567 m_datetime(datetime),
1568 m_sign(negate ? -1 : 1) {}
1569
1570 Item_func_add_time(const POS &pos, Item *a, Item *b)
1571 : Item_func_add_time(pos, a, b, false, false) {}
1572
1573 bool resolve_type(THD *) override;
1574 void print(const THD *thd, String *str,
1575 enum_query_type query_type) const override;
1576 const char *func_name() const override { return "add_time"; }
1577 enum Functype functype() const override { return ADDTIME_FUNC; }
1578 int sign() const { return m_sign; }
1579};
1580
1582 public:
1583 Item_func_timediff(const POS &pos, Item *a, Item *b)
1584 : Item_time_func(pos, a, b) {}
1585 const char *func_name() const override { return "timediff"; }
1586 enum Functype functype() const override { return TIMEDIFF_FUNC; }
1587 bool resolve_type(THD *thd) override {
1588 /*
1589 This function can operate on two TIME, or on two DATETIME (no mix).
1590 We infer the type from the other argument. If both arguments are '?', we
1591 choose VARCHAR; indeed, if we chose TIME and get DATETIME, we risk
1592 cutting the date part, and if we chose DATETIME and get TIME, we risk
1593 interpreting "01:01:01" as "2001:01:01 00:00:00".
1594 */
1595 if (param_type_uses_non_param(thd)) return true;
1597 std::max(args[0]->time_precision(), args[1]->time_precision()));
1598 set_nullable(true);
1599 return false;
1600 }
1601 bool get_time(MYSQL_TIME *ltime) override;
1602};
1603
1605 public:
1606 Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
1607 : Item_time_func(pos, a, b, c) {
1608 set_nullable(true);
1609 }
1610 bool resolve_type(THD *thd) override {
1611 if (param_type_is_default(thd, 0, 2, MYSQL_TYPE_LONGLONG)) return true;
1612 if (param_type_is_default(thd, 2, 3, MYSQL_TYPE_NEWDECIMAL)) return true;
1614 std::min(args[2]->decimals, uint8{DATETIME_MAX_DECIMALS}));
1615 return false;
1616 }
1617 const char *func_name() const override { return "maketime"; }
1618 enum Functype functype() const override { return MAKETIME_FUNC; }
1619 bool get_time(MYSQL_TIME *ltime) override;
1620};
1621
1623 public:
1624 Item_func_microsecond(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1625 longlong val_int() override;
1626 const char *func_name() const override { return "microsecond"; }
1627 enum Functype functype() const override { return MICROSECOND_FUNC; }
1628 bool resolve_type(THD *thd) override;
1629 bool check_partition_func_processor(uchar *) override { return false; }
1631 return !has_time_args();
1632 }
1633};
1634
1637
1638 public:
1640 interval_type type_arg)
1641 : Item_int_func(pos, a, b), int_type(type_arg) {}
1642 const char *func_name() const override { return "timestampdiff"; }
1643 enum Functype functype() const override { return TIMESTAMPDIFF_FUNC; }
1645 longlong val_int() override;
1646 bool resolve_type(THD *thd) override {
1647 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_DATETIME)) return true;
1648 set_nullable(true);
1649 return false;
1650 }
1651 void print(const THD *thd, String *str,
1652 enum_query_type query_type) const override;
1653};
1654
1662
1664 public:
1665 const enum_mysql_timestamp_type type; // keep it public
1667 Item *a)
1668 : Item_str_ascii_func(pos, a), type(type_arg) {}
1669 String *val_str_ascii(String *str) override;
1670 const char *func_name() const override { return "get_format"; }
1671 enum Functype functype() const override { return GET_FORMAT_FUNC; }
1672 bool resolve_type(THD *thd) override {
1673 if (param_type_is_default(thd, 0, -1)) return true;
1674 set_nullable(true);
1676 return false;
1677 }
1678 void print(const THD *thd, String *str,
1679 enum_query_type query_type) const override;
1680
1682};
1683
1686 void fix_from_format(const char *format, size_t length);
1687
1688 protected:
1689 bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1690
1691 public:
1693 : Item_temporal_hybrid_func(pos, a, b) {}
1694 const char *func_name() const override { return "str_to_date"; }
1695 bool resolve_type(THD *) override;
1696};
1697
1699 public:
1700 Item_func_last_day(const POS &pos, Item *a) : Item_date_func(pos, a) {
1701 set_nullable(true);
1702 }
1703 const char *func_name() const override { return "last_day"; }
1704 enum Functype functype() const override { return LAST_DAY_FUNC; }
1705 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1706 bool resolve_type(THD *thd) override {
1707 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_DATETIME)) return true;
1708 return Item_date_func::resolve_type(thd);
1709 }
1710};
1711
1713 public:
1715 : Item_datetime_func(pos, list) {}
1716 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1717 const char *func_name() const override { return "internal_update_time"; }
1718 bool resolve_type(THD *thd) override;
1719 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1720};
1721
1723 public:
1725 : Item_datetime_func(pos, list) {}
1726 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1727 const char *func_name() const override { return "internal_check_time"; }
1728 bool resolve_type(THD *thd) override;
1729 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1730};
1731
1732/* Function prototypes */
1733
1734bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time,
1736
1737#endif /* ITEM_TIMEFUNC_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
void set_numeric()
Definition: item.h:214
const CHARSET_INFO * collation
Definition: item.h:180
Definition: field.h:575
Implementation class for the DATE_ADD and DATE_SUB functions.
Definition: item_timefunc.h:1339
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:2654
enum Functype functype() const override
Definition: item_timefunc.h:1357
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2688
const bool m_subtract
False if function is DATE_ADD, true if function is DATE_SUB.
Definition: item_timefunc.h:1376
Item_temporal_hybrid_func super
Definition: item_timefunc.h:1340
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:2647
const char * func_name() const override
Definition: item_timefunc.h:1356
bool is_subtract() const
Definition: item_timefunc.h:1363
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.cc:2699
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2469
bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date)
Definition: item_timefunc.cc:2559
const interval_type m_interval_type
The type of the interval argument.
Definition: item_timefunc.h:1374
Item_date_add_interval(Item *a, Item *b, interval_type type, bool subtract)
POS-less ctor for post-parse construction with implicit addition to THD's free_list (see Item::Item()...
Definition: item_timefunc.h:1352
interval_type get_interval_type() const
Definition: item_timefunc.h:1362
String value
Definition: item_timefunc.h:1377
bool get_time_internal(MYSQL_TIME *res)
Definition: item_timefunc.cc:2594
Item_date_add_interval(const POS &pos, Item *a, Item *b, interval_type type, bool subtract)
Definition: item_timefunc.h:1343
Abstract class for functions returning DATE values.
Definition: item_timefunc.h:594
double val_real() override
Definition: item_timefunc.h:619
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override=0
const char * func_name() const override
Definition: item_timefunc.h:620
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:622
enum Functype functype() const override
Definition: item_timefunc.h:621
Item_date_func(const POS &pos)
Definition: item_timefunc.h:602
Item_date_func()
Definition: item_timefunc.h:601
Item_date_func(Item *a)
Definition: item_timefunc.h:605
Item_date_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:609
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:931
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:613
longlong val_int() override
Definition: item_timefunc.h:617
Item_date_func(const POS &pos, Item *a)
Definition: item_timefunc.h:606
type_conversion_status save_in_field_inner(Field *field, bool) override
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item_timefunc.h:596
String * val_str(String *str) override
Definition: item_timefunc.h:616
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:623
DATE'2010-01-01'.
Definition: item_timefunc.h:848
bool basic_const_item() const override
Returns true if this is a simple constant item like an integer, not a constant expression.
Definition: item_timefunc.h:878
Item_date_literal(MYSQL_TIME *ltime)
Constructor for Item_date_literal.
Definition: item_timefunc.h:856
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.h:868
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:876
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:955
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:947
const char * func_name() const override
Definition: item_timefunc.h:861
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:864
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:849
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.h:881
table_map used_tables() const override
Definition: item_timefunc.h:879
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:877
String * val_str(String *str) override
Definition: item_timefunc.h:872
table_map not_null_tables() const override
Return table map of tables that can't be NULL tables (tables that are used in a context where if they...
Definition: item_timefunc.h:880
Abstract class for functions returning DATETIME values.
Definition: item_timefunc.h:636
longlong val_int() override
Definition: item_timefunc.h:679
Item_datetime_func(Item *a)
Definition: item_timefunc.h:649
Item_datetime_func(const POS &pos)
Definition: item_timefunc.h:646
Item_datetime_func()
Definition: item_timefunc.h:643
String * val_str(String *str) override
Definition: item_timefunc.h:676
double val_real() override
Definition: item_timefunc.h:675
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:939
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:685
Item_datetime_func(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:670
Item_datetime_func(Item *a, Item *b, Item *c)
Definition: item_timefunc.h:659
type_conversion_status save_in_field_inner(Field *field, bool) override
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item_timefunc.h:638
Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:662
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override=0
Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_timefunc.h:666
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:681
Item_datetime_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:655
Item_datetime_func(const POS &pos, Item *a)
Definition: item_timefunc.h:652
TIMESTAMP'2001-01-01 10:20:30'.
Definition: item_timefunc.h:929
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:930
bool basic_const_item() const override
Returns true if this is a simple constant item like an integer, not a constant expression.
Definition: item_timefunc.h:963
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:961
table_map not_null_tables() const override
Return table map of tables that can't be NULL tables (tables that are used in a context where if they...
Definition: item_timefunc.h:965
enum Functype functype() const override
Definition: item_timefunc.h:946
const char * func_name() const override
Definition: item_timefunc.h:945
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.h:966
Item_datetime_literal(MYSQL_TIME *ltime, uint dec_arg, const Time_zone *tz)
Constructor for Item_datetime_literal.
Definition: item_timefunc.h:940
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:962
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:969
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:961
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.h:953
String * val_str(String *str) override
Definition: item_timefunc.h:957
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:949
table_map used_tables() const override
Definition: item_timefunc.h:964
Definition: item_timefunc.h:1380
bool date_value
Definition: item_timefunc.h:1381
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1395
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2706
const char * func_name() const override
Definition: item_timefunc.h:1389
enum Functype functype() const override
Definition: item_timefunc.h:1388
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2715
longlong val_int() override
Definition: item_timefunc.cc:2806
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1394
const interval_type int_type
Definition: item_timefunc.h:1384
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:2884
Item_extract(const POS &pos, interval_type type_arg, Item *a)
Definition: item_timefunc.h:1385
Add a time expression to a temporal expression, or subtract a time expression from a temporal express...
Definition: item_timefunc.h:1553
int m_sign
+1 for ADD, -1 for SUBTRACT
Definition: item_timefunc.h:1555
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3032
const char * func_name() const override
Definition: item_timefunc.h:1576
Item_func_add_time(Item *a, Item *b, bool datetime, bool negate)
Definition: item_timefunc.h:1560
const bool m_datetime
True if first argument expected to be datetime.
Definition: item_timefunc.h:1554
int sign() const
Definition: item_timefunc.h:1578
enum Functype functype() const override
Definition: item_timefunc.h:1577
bool val_datetime(MYSQL_TIME *time, my_time_flags_t fuzzy_date) override
ADDTIME(t,a) and SUBTIME(t,a) are time functions that calculate a time/datetime value.
Definition: item_timefunc.cc:3076
Item_func_add_time(const POS &pos, Item *a, Item *b, bool datetime, bool negate)
Definition: item_timefunc.h:1564
Item_func_add_time(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1570
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3145
This function implements the AT TIME ZONE operator, which casts a temporal value to a temporal with t...
Definition: item_timefunc.h:987
bool check_type() const
Definition: item_timefunc.cc:1038
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:990
bool set_time_zone(THD *thd)
Definition: item_timefunc.cc:1002
const char * func_name() const override
Definition: item_timefunc.h:997
bool m_is_interval
Whether the syntax used the INTERVAL construction.
Definition: item_timefunc.h:1019
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:1013
const char * m_specifier_string
The specifier string argument, not used after resolution.
Definition: item_timefunc.h:1013
const Time_zone * m_tz
The time zone that the specifier string argument resolves to.
Definition: item_timefunc.h:1010
const char * specifier_string() const
Definition: item_timefunc.h:1003
Item_func_at_time_zone(const POS &pos, Item *datetime, const char *specifier_string, bool is_interval)
Definition: item_timefunc.h:989
Definition: item_timefunc.h:1295
const char * func_name() const override
Definition: item_timefunc.h:1310
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2425
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2417
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.cc:2463
Time_zone * from_tz
Definition: item_timefunc.h:1303
Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1306
bool from_tz_cached
Definition: item_timefunc.h:1302
bool to_tz_cached
Definition: item_timefunc.h:1302
enum Functype functype() const override
Definition: item_timefunc.h:1311
Time_zone * to_tz
Definition: item_timefunc.h:1303
Definition: item_timefunc.h:1120
Time_zone * time_zone() override
Definition: item_timefunc.cc:1999
const char * func_name() const override
Definition: item_timefunc.h:1126
Item_func_curdate_local(const POS &pos)
Definition: item_timefunc.h:1125
Definition: item_timefunc.h:1129
Time_zone * time_zone() override
Definition: item_timefunc.cc:2003
Item_func_curdate_utc(const POS &pos)
Definition: item_timefunc.h:1134
const char * func_name() const override
Definition: item_timefunc.h:1135
Abstract CURDATE function.
Definition: item_timefunc.h:1090
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1994
Item_date_func super
Definition: item_timefunc.h:1091
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:2005
String * val_str(String *) override
Definition: item_timefunc.cc:2019
virtual Time_zone * time_zone()=0
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_timefunc.h:1110
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:2012
Item_func_curdate(const POS &pos)
Definition: item_timefunc.h:1097
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1987
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1102
Definition: item_timefunc.h:1065
Item_func_curtime_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1070
const char * func_name() const override
Definition: item_timefunc.h:1072
Time_zone * time_zone() override
Definition: item_timefunc.cc:2084
Definition: item_timefunc.h:1075
Time_zone * time_zone() override
Definition: item_timefunc.cc:2088
const char * func_name() const override
Definition: item_timefunc.h:1082
Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1080
Abstract CURTIME function. Children should define what time zone is used.
Definition: item_timefunc.h:1023
virtual Time_zone * time_zone()=0
String * val_str(String *) override
Definition: item_timefunc.cc:2071
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1047
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2040
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2063
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_timefunc.h:1055
Item_func_curtime(const POS &pos, uint8 dec_arg)
Constructor for Item_func_curtime.
Definition: item_timefunc.h:1040
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2033
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:1030
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.cc:2055
Item_time_func super
Definition: item_timefunc.h:1024
Definition: item_timefunc.h:1259
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:2226
const bool is_time_format
Definition: item_timefunc.h:1261
int fixed_length
Definition: item_timefunc.h:1260
const char * func_name() const override
Definition: item_timefunc.h:1269
String * val_str(String *str) override
Definition: item_timefunc.cc:2314
Item_func_date_format(const POS &pos, Item *a, Item *b, bool is_time_format_arg=false)
Definition: item_timefunc.h:1265
String value
Definition: item_timefunc.h:1262
uint format_length(const String *format)
Definition: item_timefunc.cc:2244
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2198
TS-TODO: Item_func_dayname should be derived from Item_str_func.
Definition: item_timefunc.h:354
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:363
enum Item_result result_type() const override
Definition: item_timefunc.h:369
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:366
const char * func_name() const override
Definition: item_timefunc.h:360
Item_func_dayname(const POS &pos, Item *a)
Definition: item_timefunc.h:358
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1483
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:371
String * val_str(String *str) override
Definition: item_timefunc.cc:1494
MY_LOCALE * locale
Definition: item_timefunc.h:355
enum Functype functype() const override
Definition: item_timefunc.h:361
Definition: item_timefunc.h:126
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:135
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1250
Item_func_dayofmonth(const POS &pos, Item *a)
Definition: item_timefunc.h:128
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:134
const char * func_name() const override
Definition: item_timefunc.h:131
longlong val_int() override
Definition: item_timefunc.cc:1260
enum Functype functype() const override
Definition: item_timefunc.h:132
Definition: item_timefunc.h:189
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1232
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:197
longlong val_int() override
Definition: item_timefunc.cc:1242
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:196
Item_func_dayofyear(const POS &pos, Item *a)
Definition: item_timefunc.h:191
const char * func_name() const override
Definition: item_timefunc.h:193
enum Functype functype() const override
Definition: item_timefunc.h:194
Definition: item_timefunc.h:1243
const char * func_name() const override
Definition: item_timefunc.h:1246
Item_func_from_days(const POS &pos, Item *a)
Definition: item_timefunc.h:1245
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1250
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1253
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1248
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:1893
enum Functype functype() const override
Definition: item_timefunc.h:1249
Definition: item_timefunc.h:1277
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2364
const char * func_name() const override
Definition: item_timefunc.h:1281
Item_func_from_unixtime(const POS &pos, Item *a)
Definition: item_timefunc.h:1279
enum Functype functype() const override
Definition: item_timefunc.h:1282
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2356
Definition: item_timefunc.h:1663
String * val_str_ascii(String *str) override
Definition: item_timefunc.cc:3454
const char * func_name() const override
Definition: item_timefunc.h:1670
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3481
enum Functype functype() const override
Definition: item_timefunc.h:1671
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1672
enum_mysql_timestamp_type timestamp_type() const
Definition: item_timefunc.h:1681
Item_func_get_format(const POS &pos, enum_mysql_timestamp_type type_arg, Item *a)
Definition: item_timefunc.h:1666
const enum_mysql_timestamp_type type
Definition: item_timefunc.h:1665
Definition: item_timefunc.h:202
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1328
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:210
longlong val_int() override
Definition: item_timefunc.cc:1337
const char * func_name() const override
Definition: item_timefunc.h:206
enum Functype functype() const override
Definition: item_timefunc.h:207
Item_func_hour(const POS &pos, Item *a)
Definition: item_timefunc.h:204
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:209
Definition: item_timefunc.h:1722
enum Functype functype() const override
Definition: item_timefunc.h:1726
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3762
const char * func_name() const override
Definition: item_timefunc.h:1727
Item_func_internal_check_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1724
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3754
Definition: item_timefunc.h:1712
const char * func_name() const override
Definition: item_timefunc.h:1717
enum Functype functype() const override
Definition: item_timefunc.h:1716
Item_func_internal_update_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1714
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3675
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3683
Definition: item_timefunc.h:1698
Item_func_last_day(const POS &pos, Item *a)
Definition: item_timefunc.h:1700
const char * func_name() const override
Definition: item_timefunc.h:1703
enum Functype functype() const override
Definition: item_timefunc.h:1704
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1706
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3651
Definition: item_timefunc.h:1532
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1541
enum Functype functype() const override
Definition: item_timefunc.h:1540
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
MAKEDATE(a,b) is a date function that creates a date value from a year and day value.
Definition: item_timefunc.cc:3003
Item_func_makedate(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1534
const char * func_name() const override
Definition: item_timefunc.h:1538
Definition: item_timefunc.h:1604
enum Functype functype() const override
Definition: item_timefunc.h:1618
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1610
bool get_time(MYSQL_TIME *ltime) override
MAKETIME(h,m,s) is a time function that calculates a time value from the total number of hours,...
Definition: item_timefunc.cc:3229
Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1606
const char * func_name() const override
Definition: item_timefunc.h:1617
Definition: item_timefunc.h:1622
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1630
longlong val_int() override
MICROSECOND(a) is a function ( extraction) that extracts the microseconds from a.
Definition: item_timefunc.cc:3302
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3308
enum Functype functype() const override
Definition: item_timefunc.h:1627
Item_func_microsecond(const POS &pos, Item *a)
Definition: item_timefunc.h:1624
const char * func_name() const override
Definition: item_timefunc.h:1626
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1629
Definition: item_timefunc.h:215
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1343
const char * func_name() const override
Definition: item_timefunc.h:219
longlong val_int() override
Definition: item_timefunc.cc:1352
Item_func_minute(const POS &pos, Item *a)
Definition: item_timefunc.h:217
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:222
enum Functype functype() const override
Definition: item_timefunc.h:220
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:223
TS-TODO: This should probably have Item_int_func as parent class.
Definition: item_timefunc.h:143
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1266
double val_real() override
Definition: item_timefunc.h:150
enum Item_result result_type() const override
Definition: item_timefunc.h:166
longlong val_int() override
Definition: item_timefunc.cc:1276
const char * func_name() const override
Definition: item_timefunc.h:164
String * val_str(String *str) override
Definition: item_timefunc.h:154
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:163
Item_func_month(const POS &pos, Item *a)
Definition: item_timefunc.h:145
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:169
enum Functype functype() const override
Definition: item_timefunc.h:165
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:168
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:160
Definition: item_timefunc.h:174
Item_func_monthname(const POS &pos, Item *a)
Definition: item_timefunc.h:178
MY_LOCALE * locale
Definition: item_timefunc.h:175
const char * func_name() const override
Definition: item_timefunc.h:179
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:184
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:183
String * val_str(String *str) override
Definition: item_timefunc.cc:1293
enum Functype functype() const override
Definition: item_timefunc.h:180
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1282
Definition: item_timefunc.h:1183
static void store_in(Field *field)
Stores the query start time in a field, truncating to the field's number of fractional second digits.
Definition: item_timefunc.cc:2100
Time_zone * time_zone() override
Definition: item_timefunc.cc:2107
const char * func_name() const override
Definition: item_timefunc.h:1200
Item_func_now_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1197
enum Functype functype() const override
Definition: item_timefunc.h:1201
Item_func_now_local(uint8 dec_arg)
Definition: item_timefunc.h:1196
Definition: item_timefunc.h:1204
const char * func_name() const override
Definition: item_timefunc.h:1216
Item_func_now_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1211
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2109
Item_func_now super
Definition: item_timefunc.h:1205
Time_zone * time_zone() override
Definition: item_timefunc.cc:2116
Abstract CURRENT_TIMESTAMP function.
Definition: item_timefunc.h:1143
Item_func_now(uint8 dec_arg)
Constructor for Item_func_now.
Definition: item_timefunc.h:1159
type_conversion_status save_in_field_inner(Field *to, bool no_conversions) override
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item_timefunc.cc:2147
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:2118
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2092
virtual Time_zone * time_zone()=0
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_timefunc.h:1173
String * val_str(String *) override
Definition: item_timefunc.cc:2134
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:1149
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1165
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:2126
Item_func_now(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1160
Definition: item_timefunc.h:66
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1052
longlong val_int() override
Definition: item_timefunc.cc:1056
enum Functype functype() const override
Definition: item_timefunc.h:72
const char * func_name() const override
Definition: item_timefunc.h:71
Item_func_period_add(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:68
Definition: item_timefunc.h:76
const char * func_name() const override
Definition: item_timefunc.h:81
enum Functype functype() const override
Definition: item_timefunc.h:82
Item_func_period_diff(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:78
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1070
longlong val_int() override
Definition: item_timefunc.cc:1074
Definition: item_timefunc.h:228
const char * func_name() const override
Definition: item_timefunc.h:232
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:235
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:236
enum Functype functype() const override
Definition: item_timefunc.h:233
Item_func_quarter(const POS &pos, Item *a)
Definition: item_timefunc.h:230
longlong val_int() override
Returns the quarter of the year.
Definition: item_timefunc.cc:1321
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1308
Definition: item_timefunc.h:1317
const char * func_name() const override
Definition: item_timefunc.h:1328
Item_func_sec_to_time(const POS &pos, Item *item)
Definition: item_timefunc.h:1319
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1321
enum Functype functype() const override
Definition: item_timefunc.h:1329
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2179
Definition: item_timefunc.h:241
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:249
const char * func_name() const override
Definition: item_timefunc.h:245
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:248
enum Functype functype() const override
Definition: item_timefunc.h:246
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1358
Item_func_second(const POS &pos, Item *a)
Definition: item_timefunc.h:243
longlong val_int() override
Returns the second in time_exp in the range of 0 - 59.
Definition: item_timefunc.cc:1370
Definition: item_timefunc.h:1684
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3568
Item_func_str_to_date(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1692
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:3601
void fix_from_format(const char *format, size_t length)
Set type of datetime value (DATE/TIME/...) which will be produced according to format string.
Definition: item_timefunc.cc:3518
const char * func_name() const override
Definition: item_timefunc.h:1694
enum_mysql_timestamp_type cached_timestamp_type
Definition: item_timefunc.h:1685
SYSDATE() is like NOW(), but always uses the real current time, not the query_start().
Definition: item_timefunc.h:1223
table_map get_initial_pseudo_tables() const override
This function is non-deterministic and hence depends on the 'RAND' pseudo-table.
Definition: item_timefunc.h:1238
const char * func_name() const override
Definition: item_timefunc.h:1228
Item_func_sysdate_local(uint8 dec_arg)
Definition: item_timefunc.h:1225
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2173
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Converts current time in my_time_t to MYSQL_TIME representation for local time zone.
Definition: item_timefunc.cc:2160
enum Functype functype() const override
Definition: item_timefunc.h:1230
Definition: item_timefunc.h:463
enum Functype functype() const override
Definition: item_timefunc.h:469
longlong val_int() override
Definition: item_timefunc.cc:1727
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:471
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1720
Item_func_time_to_sec(const POS &pos, Item *item)
Definition: item_timefunc.h:465
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:472
const char * func_name() const override
Definition: item_timefunc.h:468
Definition: item_timefunc.h:1581
bool get_time(MYSQL_TIME *ltime) override
TIMEDIFF(t,s) is a time function that calculates the time value between a start and end time.
Definition: item_timefunc.cc:3173
enum Functype functype() const override
Definition: item_timefunc.h:1586
Item_func_timediff(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1583
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1587
const char * func_name() const override
Definition: item_timefunc.h:1585
Definition: item_timefunc.h:1635
interval_type intervaltype() const
Definition: item_timefunc.h:1644
const char * func_name() const override
Definition: item_timefunc.h:1642
enum Functype functype() const override
Definition: item_timefunc.h:1643
longlong val_int() override
Definition: item_timefunc.cc:3314
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3410
Item_func_timestamp_diff(const POS &pos, Item *a, Item *b, interval_type type_arg)
Definition: item_timefunc.h:1639
const interval_type int_type
Definition: item_timefunc.h:1636
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1646
Definition: item_timefunc.h:86
Item_func_to_days(const POS &pos, Item *a)
Definition: item_timefunc.h:88
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1089
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:95
longlong val_int() override
Definition: item_timefunc.cc:1102
enum Functype functype() const override
Definition: item_timefunc.h:91
const char * func_name() const override
Definition: item_timefunc.h:90
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:96
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1183
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1164
Definition: item_timefunc.h:101
bool intro_version(uchar *int_arg) override
Definition: item_timefunc.h:112
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1174
Item_func_to_seconds(const POS &pos, Item *a)
Definition: item_timefunc.h:103
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1132
longlong val_int() override
Definition: item_timefunc.cc:1138
enum Functype functype() const override
Definition: item_timefunc.h:106
const char * func_name() const override
Definition: item_timefunc.h:105
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:110
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1109
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:121
Definition: item_timefunc.h:405
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:422
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_timefunc.h:432
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1711
const char * func_name() const override
Definition: item_timefunc.h:416
Item_func_unix_timestamp(const POS &pos)
Definition: item_timefunc.h:409
bool check_function_as_value_generator(uchar *p_arg) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_timefunc.h:450
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:437
Item_timeval_func super
Definition: item_timefunc.h:406
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1704
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1681
Item_func_unix_timestamp(Item *a)
Definition: item_timefunc.h:411
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:428
enum Functype functype() const override
Definition: item_timefunc.h:417
Item_func_unix_timestamp(const POS &pos, Item *a)
Definition: item_timefunc.h:413
bool val_timeval(my_timeval *tm) override
Definition: item_timefunc.cc:1692
Definition: item_timefunc.h:254
const char * func_name() const override
Definition: item_timefunc.h:264
longlong val_int() override
Definition: item_timefunc.cc:1435
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1382
Item_func_week(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:259
Item_func_week(Item *a, Item *b)
Definition: item_timefunc.h:258
Item_int_func super
Definition: item_timefunc.h:255
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1393
enum Functype functype() const override
Definition: item_timefunc.h:265
TS-TODO: This should probably have Item_int_func as parent class.
Definition: item_timefunc.h:314
Item_func_weekday(const POS &pos, Item *a, bool type_arg)
Definition: item_timefunc.h:318
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:343
const char * func_name() const override
Definition: item_timefunc.h:337
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:344
double val_real() override
Definition: item_timefunc.h:324
String * val_str(String *str) override
Definition: item_timefunc.h:328
bool odbc_type
Definition: item_timefunc.h:315
enum Item_result result_type() const override
Definition: item_timefunc.h:341
enum Functype functype() const override
Definition: item_timefunc.h:340
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1463
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:336
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:333
longlong val_int() override
Definition: item_timefunc.cc:1472
Definition: item_timefunc.h:283
enum Functype functype() const override
Definition: item_timefunc.h:288
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1625
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1617
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:292
const char * func_name() const override
Definition: item_timefunc.h:287
longlong val_int() override
Definition: item_timefunc.cc:1515
Item_func_year(const POS &pos, Item *a)
Definition: item_timefunc.h:285
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1508
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:293
Definition: item_timefunc.h:269
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:277
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1443
enum Functype functype() const override
Definition: item_timefunc.h:275
longlong val_int() override
Definition: item_timefunc.cc:1453
Item_func_yearweek(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:271
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:278
const char * func_name() const override
Definition: item_timefunc.h:274
Definition: item_func.h:102
bool param_type_uses_non_param(THD *thd, enum_field_types def=MYSQL_TYPE_VARCHAR)
Definition: item_func.cc:616
Item ** args
Array of pointers to arguments.
Definition: item_func.h:109
Functype
Definition: item_func.h:187
@ DATEADD_FUNC
Definition: item_func.h:294
@ YEAR_FUNC
Definition: item_func.h:274
@ HOUR_FUNC
Definition: item_func.h:285
@ TIME_TO_SEC_FUNC
Definition: item_func.h:299
@ PERIODDIFF_FUNC
Definition: item_func.h:315
@ FROM_UNIXTIME_FUNC
Definition: item_func.h:295
@ MAKETIME_FUNC
Definition: item_func.h:277
@ NOW_FUNC
Definition: item_func.h:229
@ FROM_DAYS_FUNC
Definition: item_func.h:230
@ CONVERT_TZ_FUNC
Definition: item_func.h:296
@ DD_INTERNAL_FUNC
Definition: item_func.h:244
@ DAY_FUNC
Definition: item_func.h:280
@ MAKEDATE_FUNC
Definition: item_func.h:276
@ SEC_TO_TIME_FUNC
Definition: item_func.h:316
@ DATE_FUNC
Definition: item_func.h:284
@ TIMESTAMPDIFF_FUNC
Definition: item_func.h:300
@ SECOND_FUNC
Definition: item_func.h:287
@ PERIODADD_FUNC
Definition: item_func.h:314
@ EXTRACT_FUNC
Definition: item_func.h:235
@ MONTH_FUNC
Definition: item_func.h:278
@ TO_SECONDS_FUNC
Definition: item_func.h:283
@ MICROSECOND_FUNC
Definition: item_func.h:288
@ QUARTER_FUNC
Definition: item_func.h:291
@ TIMEDIFF_FUNC
Definition: item_func.h:313
@ SYSDATE_FUNC
Definition: item_func.h:312
@ MONTHNAME_FUNC
Definition: item_func.h:279
@ TYPECAST_FUNC
Definition: item_func.h:236
@ LAST_DAY_FUNC
Definition: item_func.h:297
@ WEEKDAY_FUNC
Definition: item_func.h:293
@ ADDTIME_FUNC
Definition: item_func.h:290
@ DAYOFYEAR_FUNC
Definition: item_func.h:289
@ GET_FORMAT_FUNC
Definition: item_func.h:317
@ DAYNAME_FUNC
Definition: item_func.h:281
@ DATETIME_LITERAL
Definition: item_func.h:301
@ MINUTE_FUNC
Definition: item_func.h:286
@ TO_DAYS_FUNC
Definition: item_func.h:282
@ WEEK_FUNC
Definition: item_func.h:292
@ YEARWEEK_FUNC
Definition: item_func.h:275
@ UNIX_TIMESTAMP_FUNC
Definition: item_func.h:298
bool has_timestamp_args()
Definition: item_func.h:624
enum Type type() const override
Definition: item_func.h:332
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:527
bool propagate_type(THD *thd, const Type_properties &type) override
Default implementation for all functions: Propagate base_item's type into all arguments.
Definition: item_func.cc:503
bool has_date_args()
Definition: item_func.h:634
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:132
bool has_time_args()
Definition: item_func.h:645
bool has_datetime_args()
Definition: item_func.h:656
Definition: item_func.h:983
virtual const char * func_name() const =0
Definition: item_strfunc.h:148
Definition: item_strfunc.h:76
String * val_str_from_val_str_ascii(String *str, String *str2)
Definition: item_strfunc.cc:149
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:140
Abstract class for functions returning TIME, DATE, DATETIME types whose data type is known at constru...
Definition: item_timefunc.h:481
Item_temporal_func()
Definition: item_timefunc.h:492
Item_temporal_func(const POS &pos, Item *a)
Definition: item_timefunc.h:496
Item_temporal_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:498
Item_temporal_func(const POS &pos)
Definition: item_timefunc.h:493
Item_temporal_func(Item *a)
Definition: item_timefunc.h:495
Item_temporal_func(Item *a, Item *b, Item *c)
Definition: item_timefunc.h:500
Field * tmp_table_field(TABLE *table) override
Definition: item_timefunc.h:512
Item_temporal_func(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:505
bool check_precision()
Definition: item_timefunc.cc:806
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:486
Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:501
Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_timefunc.h:503
uint datetime_precision() override
DATETIME precision of the item: 0..6.
Definition: item_timefunc.h:519
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:826
uint time_precision() override
TIME precision of the item: 0..6.
Definition: item_timefunc.h:515
const CHARSET_INFO * charset_for_protocol() override
Definition: item_timefunc.h:509
Item_result result_type() const override
Definition: item_timefunc.h:508
Abstract class for functions returning TIME, DATE, DATETIME or string values, whose data type depends...
Definition: item_timefunc.h:531
const CHARSET_INFO * charset_for_protocol() override
Definition: item_timefunc.h:556
Field * tmp_table_field(TABLE *table) override
Definition: item_timefunc.h:567
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.cc:855
sql_mode_t sql_mode
Definition: item_timefunc.h:533
double val_real() override
Definition: item_timefunc.h:571
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:545
Item_result result_type() const override
Definition: item_timefunc.h:555
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:890
Item_temporal_hybrid_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:552
virtual bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date)=0
Get "native" temporal value as MYSQL_TIME.
Item_temporal_hybrid_func(Item *a, Item *b)
Definition: item_timefunc.h:550
String * val_str(String *str) override
Return string value in @character_set_connection.
Definition: item_timefunc.h:580
String * val_str_ascii(String *str) override
Return string value in ASCII character set.
Definition: item_timefunc.cc:901
longlong val_int() override
Definition: item_timefunc.h:570
String ascii_buf
Definition: item_timefunc.h:534
type_conversion_status save_in_field_inner(Field *field, bool no_conversions) override
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item_timefunc.cc:848
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.cc:876
Abstract class for functions returning TIME values.
Definition: item_timefunc.h:697
type_conversion_status save_in_field_inner(Field *field, bool) override
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item_timefunc.h:699
longlong val_int() override
Definition: item_timefunc.h:727
String * val_str(String *str) override
Definition: item_timefunc.h:732
Item_time_func(const POS &pos, Item *a)
Definition: item_timefunc.h:711
Item_time_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:718
Item_time_func(Item *a)
Definition: item_timefunc.h:708
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.cc:925
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:723
Item_time_func(const POS &pos)
Definition: item_timefunc.h:705
bool get_time(MYSQL_TIME *res) override=0
double val_real() override
Definition: item_timefunc.h:722
Item_time_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:714
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.h:729
Item_time_func()
Definition: item_timefunc.h:704
TIME'10:10:10'.
Definition: item_timefunc.h:888
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:909
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:917
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:918
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.h:922
bool basic_const_item() const override
Returns true if this is a simple constant item like an integer, not a constant expression.
Definition: item_timefunc.h:919
Item_time_literal(MYSQL_TIME *ltime, uint dec_arg)
Constructor for Item_time_literal.
Definition: item_timefunc.h:897
const char * func_name() const override
Definition: item_timefunc.h:902
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:984
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.h:905
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:976
table_map used_tables() const override
Definition: item_timefunc.h:920
table_map not_null_tables() const override
Return table map of tables that can't be NULL tables (tables that are used in a context where if they...
Definition: item_timefunc.h:921
String * val_str(String *str) override
Definition: item_timefunc.h:913
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:889
Definition: item_timefunc.h:377
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:394
virtual bool val_timeval(my_timeval *tm)=0
Return timestamp in "struct timeval" format.
longlong val_int() override
Definition: item_timefunc.cc:1652
String * val_str(String *str) override
Definition: item_timefunc.cc:1672
Item_timeval_func(const POS &pos, Item *a)
Definition: item_timefunc.h:382
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.cc:1657
Item_timeval_func(Item *a)
Definition: item_timefunc.h:381
enum Item_result result_type() const override
Definition: item_timefunc.h:400
Item_timeval_func(const POS &pos)
Definition: item_timefunc.h:379
double val_real() override
Definition: item_timefunc.cc:1665
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:397
Definition: item_timefunc.h:1432
bool m_explicit_cast
Definition: item_timefunc.h:1433
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1444
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:2957
const char * cast_type() const
Definition: item_timefunc.h:1454
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2966
const char * func_name() const override
Definition: item_timefunc.h:1450
bool is_explicit_cast() const
Definition: item_timefunc.h:1452
enum Functype functype() const override
Definition: item_timefunc.h:1451
Item_typecast_date(Item *a, bool explicit_cast)
Definition: item_timefunc.h:1436
Item_typecast_date(const POS &pos, Item *a)
Definition: item_timefunc.h:1440
Definition: item_timefunc.h:1494
Item_typecast_datetime(Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1511
Item_typecast_datetime(const POS &pos, Item *a)
Definition: item_timefunc.h:1503
Item_typecast_datetime(Item *a, bool explicit_cast)
Definition: item_timefunc.h:1499
enum Functype functype() const override
Definition: item_timefunc.h:1518
bool is_explicit_cast() const
Definition: item_timefunc.h:1520
const char * func_name() const override
Definition: item_timefunc.h:1517
bool m_explicit_cast
Definition: item_timefunc.h:1496
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1521
Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1506
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:2897
bool detect_precision_from_arg
Definition: item_timefunc.h:1495
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2907
const char * cast_type() const
Definition: item_timefunc.h:1519
Definition: item_timefunc.h:1457
Item_typecast_time(Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1473
Item_typecast_time(const POS &pos, Item *a)
Definition: item_timefunc.h:1465
bool is_explicit_cast() const
Definition: item_timefunc.h:1481
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1484
Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1468
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2945
const char * cast_type() const
Definition: item_timefunc.h:1483
enum Functype functype() const override
Definition: item_timefunc.h:1480
bool detect_precision_from_arg
Definition: item_timefunc.h:1458
Item_typecast_time(Item *a)
Definition: item_timefunc.h:1462
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str.
Definition: item_timefunc.cc:2935
const char * func_name() const override
Definition: item_timefunc.h:1479
bool m_explicit_cast
Definition: item_timefunc.h:1459
Definition: item_timefunc.h:298
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1521
Item_typecast_year(const POS &pos, Item *a)
Definition: item_timefunc.h:300
longlong val_int() override
Definition: item_timefunc.cc:1536
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:1529
enum Functype functype() const override
Definition: item_timefunc.h:305
const char * func_name() const override
Definition: item_timefunc.h:304
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:934
void set_nullable(bool nullable)
Definition: item.h:3637
void set_data_type_date()
Set all type properties for Item of DATE type.
Definition: item.h:1681
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3535
longlong val_int_from_decimal()
Definition: item.cc:477
void set_data_type(enum_field_types data_type)
Set the data type of the current Item.
Definition: item.h:1499
longlong val_int_from_datetime()
Definition: item.cc:508
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1688
static const CHARSET_INFO * default_charset()
Definition: item.cc:1800
String * val_string_from_date(String *str)
Definition: item.cc:331
double val_real_from_decimal()
Definition: item.cc:459
String * val_string_from_datetime(String *str)
Definition: item.cc:321
bool get_date_from_time(MYSQL_TIME *ltime)
Convert get_time() from time to date in MYSQL_TIME.
Definition: item.cc:1638
bool get_time_from_datetime(MYSQL_TIME *ltime)
Convert datetime to time.
Definition: item.cc:1733
longlong val_int_from_date()
Definition: item.cc:500
void set_data_type_year()
Set the data type of the Item to be YEAR.
Definition: item.h:1746
Field * tmp_table_field_from_field_type(TABLE *table, bool fixed_length) const
Create a field based on field_type of argument.
Definition: item.cc:6615
bool get_time_from_date(MYSQL_TIME *ltime)
Convert date to time.
Definition: item.cc:1725
enum_field_types data_type() const
Retrieve the derived data type of the Item.
Definition: item.h:1467
bool fixed
True if item has been resolved.
Definition: item.h:3625
longlong val_int_from_time()
Definition: item.cc:486
bool null_value
True if item is null.
Definition: item.h:3662
void set_data_type_datetime(uint8 fsp)
Set all properties for Item of DATETIME type.
Definition: item.h:1705
virtual uint datetime_precision()
DATETIME precision of the item: 0..6.
Definition: item.cc:814
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1648
my_decimal * val_decimal_from_date(my_decimal *decimal_value)
Definition: item.cc:384
@ MARKER_NONE
Definition: item.h:3555
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1601
type_conversion_status save_time_in_field(Field *field)
Definition: item.cc:531
item_marker marker
This member has several successive meanings, depending on the phase we're in (.
Definition: item.h:3594
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1740
uint8 decimals
Number of decimals in result when evaluating this item.
Definition: item.h:3634
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1585
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1629
String * val_string_from_time(String *str)
Definition: item.cc:341
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1541
void set_data_type_time(uint8 fsp)
Set all type properties for Item of TIME type.
Definition: item.h:1693
void set_data_type_decimal(uint8 precision, uint8 scale)
Set the data type of the Item to be decimal.
Definition: item.h:1555
my_decimal * val_decimal_from_time(my_decimal *decimal_value)
Definition: item.cc:393
type_conversion_status save_date_in_field(Field *field)
Definition: item.cc:538
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1716
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
bool add_alias(const std::string &key, Json_dom *value)
Insert the value into the object.
Definition: json_dom.h:411
Cache for MYSQL_TIME value with various representations.
Definition: item_timefunc.h:746
uint string_length
length of string
Definition: item_timefunc.h:750
bool get_date(MYSQL_TIME *ltime, uint fuzzyflags) const
Store MYSQL_TIME representation into the given date/datetime variable checking date flags.
Definition: item_timefunc.cc:1973
void set_time(MYSQL_TIME *ltime, uint8 dec_arg)
Set time and time_packed from a TIME value.
Definition: item_timefunc.cc:1917
MYSQL_TIME * get_TIME_ptr()
Return pointer to MYSQL_TIME representation.
Definition: item_timefunc.h:831
bool get_time(MYSQL_TIME *ltime) const
Store MYSQL_TIME representation into the given time variable.
Definition: item_timefunc.h:824
longlong val_packed() const
Return packed representation.
Definition: item_timefunc.h:812
MYSQL_TIME_cache()
Definition: item_timefunc.h:762
uint8 decimals() const
Return number of decimal digits.
Definition: item_timefunc.h:804
uint8 dec
Number of decimals.
Definition: item_timefunc.h:751
const char * cptr() const
Return C string representation.
Definition: item_timefunc.h:842
longlong time_packed
packed representation
Definition: item_timefunc.h:748
void set_date(MYSQL_TIME *ltime)
Set time and time_packed from a DATE value.
Definition: item_timefunc.cc:1925
MYSQL_TIME time
MYSQL_TIME representation.
Definition: item_timefunc.h:747
void set_datetime(MYSQL_TIME *ltime, uint8 dec_arg, const Time_zone *tz=nullptr)
Set time and time_packed from a DATETIME value.
Definition: item_timefunc.cc:1933
bool eq(const MYSQL_TIME_cache &tm) const
Test if cached value is equal to another MYSQL_TIME_cache value.
Definition: item_timefunc.h:797
String * val_str(String *str)
Store string representation into String.
Definition: item_timefunc.cc:1980
char string_buff[MAX_DATE_STRING_REP_LENGTH]
string representation
Definition: item_timefunc.h:749
void get_TIME(MYSQL_TIME *ltime) const
Store MYSQL_TIME representation into the given MYSQL_TIME variable.
Definition: item_timefunc.h:756
Definition: sql_locale.h:37
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:105
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:231
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:49
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:95
uint64_t sql_mode_t
Definition: dd_event.h:39
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:202
@ VGS_CHECK_CONSTRAINT
Definition: field.h:476
@ VGS_GENERATED_COLUMN
Definition: field.h:474
This file contains the field type.
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:64
@ MYSQL_TYPE_TIME
Definition: field_types.h:67
@ MYSQL_TYPE_STRING
Definition: field_types.h:88
@ MYSQL_TYPE_NEWDECIMAL
Definition: field_types.h:80
@ MYSQL_TYPE_DATE
Definition: field_types.h:66
@ MYSQL_TYPE_DATETIME
Definition: field_types.h:68
static const std::string dec("DECRYPTION")
enum monotonicity_info enum_monotonicity_info
const char * interval_names[]
Definition: item_timefunc.cc:2667
bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time, enum_mysql_timestamp_type type, String *str)
Create a formatted date/time value in a string.
Definition: item_timefunc.cc:521
date_time_format
Definition: item_timefunc.h:1655
@ USA_FORMAT
Definition: item_timefunc.h:1656
@ JIS_FORMAT
Definition: item_timefunc.h:1657
@ INTERNAL_FORMAT
Definition: item_timefunc.h:1660
@ EUR_FORMAT
Definition: item_timefunc.h:1659
@ ISO_FORMAT
Definition: item_timefunc.h:1658
bool get_interval_value(Item *args, interval_type int_type, String *str_value, Interval *interval)
Convert a string to a interval value.
Definition: item_timefunc.cc:1742
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:509
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:63
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
uint64_t table_map
Definition: my_table_map.h:30
Interface for low level time utilities.
constexpr const int DATETIME_MAX_DECIMALS
Definition: my_time.h:143
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:94
constexpr const std::size_t MAX_DATE_STRING_REP_LENGTH
Required buffer length for my_time_to_str, my_date_to_str, my_datetime_to_str and TIME_to_string func...
Definition: my_time.h:430
interval_type
Available interval types used in any statement.
Definition: my_time.h:455
@ INTERVAL_HOUR_SECOND
Definition: my_time.h:470
@ INTERVAL_MONTH
Definition: my_time.h:458
@ INTERVAL_HOUR_MICROSECOND
Definition: my_time.h:473
@ INTERVAL_MINUTE
Definition: my_time.h:462
@ INTERVAL_HOUR_MINUTE
Definition: my_time.h:469
@ INTERVAL_DAY
Definition: my_time.h:460
@ INTERVAL_MINUTE_MICROSECOND
Definition: my_time.h:474
@ INTERVAL_MINUTE_SECOND
Definition: my_time.h:471
@ INTERVAL_QUARTER
Definition: my_time.h:457
@ INTERVAL_YEAR
Definition: my_time.h:456
@ INTERVAL_DAY_MICROSECOND
Definition: my_time.h:472
@ INTERVAL_SECOND_MICROSECOND
Definition: my_time.h:475
@ INTERVAL_SECOND
Definition: my_time.h:463
@ INTERVAL_DAY_HOUR
Definition: my_time.h:466
@ INTERVAL_HOUR
Definition: my_time.h:461
@ INTERVAL_YEAR_MONTH
Definition: my_time.h:465
@ INTERVAL_DAY_SECOND
Definition: my_time.h:468
@ INTERVAL_MICROSECOND
Definition: my_time.h:464
@ INTERVAL_DAY_MINUTE
Definition: my_time.h:467
Time declarations shared between the server and client API: you should not add anything to this heade...
enum_mysql_timestamp_type
Definition: mysql_time.h:45
@ MYSQL_TIMESTAMP_NONE
Definition: mysql_time.h:46
static int interval
Definition: mysqladmin.cc:71
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1073
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2878
required string type
Definition: replication_group_member_actions.proto:34
"public" interface to sys_var - server configuration variables.
File containing constants that can be used throughout the server.
constexpr const table_map RAND_TABLE_BIT
Definition: sql_const.h:112
constexpr const table_map INNER_TABLE_BIT
Definition: sql_const.h:110
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:423
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:491
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:505
Value_generator_source source
Definition: item.h:503
Representation of time formats.
Definition: sql_time.h:61
Struct representing a duration.
Definition: my_time.h:228
Definition: mysql_time.h:82
enum enum_mysql_timestamp_type time_type
Definition: mysql_time.h:86
Bison "location" class.
Definition: parse_location.h:43
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:420
Definition: table.h:1405
Replacement of system's struct timeval to ensure we can carry 64 bit values even on a platform which ...
Definition: my_time_t.h:45
static task_arg int_arg(int i)
Definition: task.h:165
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
@ STRING_RESULT
not valid for UDFs
Definition: udf_registration_types.h:41
@ DECIMAL_RESULT
not valid for UDFs
Definition: udf_registration_types.h:45
@ INT_RESULT
double
Definition: udf_registration_types.h:43