MySQL 9.0.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;
439 if (reject_vector_args()) return true;
441 const uint8 dec = arg_count == 0 ? 0 : args[0]->datetime_precision();
442 if (dec > 0) {
444 } else {
446 }
447 return false;
448 }
449 bool val_timeval(my_timeval *tm) override;
450
452 /*
453 TODO: Allow UNIX_TIMESTAMP called with an argument to be a part
454 of the expression for a generated column too.
455 */
457 pointer_cast<Check_function_as_value_generator_parameters *>(p_arg);
458 func_arg->banned_function_name = func_name();
459 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
460 (func_arg->source == VGS_CHECK_CONSTRAINT));
461 }
462};
463
465 public:
466 Item_func_time_to_sec(const POS &pos, Item *item)
467 : Item_int_func(pos, item) {}
468 longlong val_int() override;
469 const char *func_name() const override { return "time_to_sec"; }
470 enum Functype functype() const override { return TIME_TO_SEC_FUNC; }
471 bool resolve_type(THD *thd) override;
472 bool check_partition_func_processor(uchar *) override { return false; }
474 return !has_time_args();
475 }
476};
477
478/**
479 Abstract class for functions returning TIME, DATE, DATETIME types
480 whose data type is known at constructor time.
481*/
483 protected:
484 bool check_precision();
485
486 protected:
487 void add_json_info(Json_object *obj) override {
488 if (decimals > 0)
489 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
490 }
491
492 public:
494 explicit Item_temporal_func(const POS &pos) : Item_func(pos) {}
495
497 Item_temporal_func(const POS &pos, Item *a) : Item_func(pos, a) {}
498
499 Item_temporal_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {}
500
501 Item_temporal_func(Item *a, Item *b, Item *c) : Item_func(a, b, c) {}
502 Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c)
503 : Item_func(pos, a, b, c) {}
504 Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
505 : Item_func(pos, a, b, c, d) {}
507 : Item_func(pos, list) {}
508
509 Item_result result_type() const override { return STRING_RESULT; }
511 return &my_charset_bin;
512 }
515 }
516 uint time_precision() override {
517 assert(fixed);
518 return decimals;
519 }
520 uint datetime_precision() override {
521 assert(fixed);
522 return decimals;
523 }
524 void print(const THD *thd, String *str,
525 enum_query_type query_type) const override;
526};
527
528/**
529 Abstract class for functions returning TIME, DATE, DATETIME or string values,
530 whose data type depends on parameters and is set at fix_field time.
531*/
533 protected:
534 sql_mode_t sql_mode; // sql_mode value is cached here in resolve_type()
535 String ascii_buf; // Conversion buffer
536 /**
537 Get "native" temporal value as MYSQL_TIME
538 @param[out] ltime The value is stored here.
539 @param[in] fuzzy_date Date flags.
540 @retval false On success.
541 @retval true On error.
542 */
543 virtual bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) = 0;
545 bool no_conversions) override;
546 void add_json_info(Json_object *obj) override {
548 }
549
550 public:
552 : Item_str_func(a, b), sql_mode(0) {}
554 : Item_str_func(pos, a, b), sql_mode(0) {}
555
556 Item_result result_type() const override { return STRING_RESULT; }
558 /*
559 Can return TIME, DATE, DATETIME or VARCHAR depending on arguments.
560 Send using "binary" when TIME, DATE or DATETIME,
561 or using collation.collation when VARCHAR
562 (which is fixed from @collation_connection in resolve_type()).
563 */
564 assert(fixed);
567 }
570 }
571 longlong val_int() override { return val_int_from_decimal(); }
572 double val_real() override { return val_real_from_decimal(); }
573 my_decimal *val_decimal(my_decimal *decimal_value) override;
574 /**
575 Return string value in ASCII character set.
576 */
577 String *val_str_ascii(String *str) override;
578 /**
579 Return string value in @@character_set_connection.
580 */
581 String *val_str(String *str) override {
583 }
584 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
585 bool get_time(MYSQL_TIME *ltime) override;
586};
587
588/*
589 This can't be a Item_str_func, because the val_real() functions are special
590*/
591
592/**
593 Abstract class for functions returning DATE values.
594*/
596 protected:
598 return save_date_in_field(field);
599 }
600
601 public:
603 explicit Item_date_func(const POS &pos) : Item_temporal_func(pos) {
605 }
607 Item_date_func(const POS &pos, Item *a) : Item_temporal_func(pos, a) {
609 }
610 Item_date_func(const POS &pos, Item *a, Item *b)
611 : Item_temporal_func(pos, a, b) {
613 }
614 bool get_time(MYSQL_TIME *ltime) override {
615 return get_time_from_date(ltime);
616 }
618 longlong val_int() override { return val_int_from_date(); }
619 longlong val_date_temporal() override;
620 double val_real() override { return static_cast<double>(val_int()); }
621 const char *func_name() const override { return "date"; }
622 enum Functype functype() const override { return DATE_FUNC; }
623 bool resolve_type(THD *) override { return false; }
624 my_decimal *val_decimal(my_decimal *decimal_value) override {
625 assert(fixed);
626 return val_decimal_from_date(decimal_value);
627 }
628 // All date functions must implement get_date()
629 // to avoid use of generic Item::get_date()
630 // which converts to string and then parses the string as DATE.
631 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override = 0;
632};
633
634/**
635 Abstract class for functions returning DATETIME values.
636*/
638 protected:
640 return save_date_in_field(field);
641 }
642
643 public:
646 }
649 }
652 }
653 Item_datetime_func(const POS &pos, Item *a) : Item_temporal_func(pos, a) {
655 }
656 Item_datetime_func(const POS &pos, Item *a, Item *b)
657 : Item_temporal_func(pos, a, b) {
659 }
662 }
663 Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c)
664 : Item_temporal_func(pos, a, b, c) {
666 }
667 Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
668 : Item_temporal_func(pos, a, b, c, d) {
670 }
672 : Item_temporal_func(pos, list) {
674 }
675
676 double val_real() override { return val_real_from_decimal(); }
677 String *val_str(String *str) override {
679 }
680 longlong val_int() override { return val_int_from_datetime(); }
681 longlong val_date_temporal() override;
682 my_decimal *val_decimal(my_decimal *decimal_value) override {
683 assert(fixed);
684 return val_decimal_from_date(decimal_value);
685 }
686 bool get_time(MYSQL_TIME *ltime) override {
687 return get_time_from_datetime(ltime);
688 }
689 // All datetime functions must implement get_date()
690 // to avoid use of generic Item::get_date()
691 // which converts to string and then parses the string as DATETIME.
692 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override = 0;
693};
694
695/**
696 Abstract class for functions returning TIME values.
697*/
699 protected:
701 return save_time_in_field(field);
702 }
703
704 public:
706 explicit Item_time_func(const POS &pos) : Item_temporal_func(pos) {
708 }
711 }
712 Item_time_func(const POS &pos, Item *a) : Item_temporal_func(pos, a) {
714 }
715 Item_time_func(const POS &pos, Item *a, Item *b)
716 : Item_temporal_func(pos, a, b) {
718 }
719 Item_time_func(const POS &pos, Item *a, Item *b, Item *c)
720 : Item_temporal_func(pos, a, b, c) {
722 }
723 double val_real() override { return val_real_from_decimal(); }
724 my_decimal *val_decimal(my_decimal *decimal_value) override {
725 assert(fixed);
726 return val_decimal_from_time(decimal_value);
727 }
728 longlong val_int() override { return val_int_from_time(); }
729 longlong val_time_temporal() override;
730 bool get_date(MYSQL_TIME *res, my_time_flags_t) override {
731 return get_date_from_time(res);
732 }
734 // All time functions must implement get_time()
735 // to avoid use of generic Item::get_time()
736 // which converts to string and then parses the string as TIME.
737 bool get_time(MYSQL_TIME *res) override = 0;
738};
739
740/**
741 Cache for MYSQL_TIME value with various representations.
742
743 - MYSQL_TIME representation (time) is initialized during set_XXX().
744 - Packed representation (time_packed) is also initialized during set_XXX().
745 - String representation (string_buff) is also initialized during set_XXX();
746*/
748 MYSQL_TIME time; ///< MYSQL_TIME representation
749 longlong time_packed; ///< packed representation
750 char string_buff[MAX_DATE_STRING_REP_LENGTH]; ///< string representation
751 uint string_length; ///< length of string
752 uint8 dec; ///< Number of decimals
753
754 /**
755 Store MYSQL_TIME representation into the given MYSQL_TIME variable.
756 */
757 void get_TIME(MYSQL_TIME *ltime) const {
759 *ltime = time;
760 }
761
762 public:
765 string_buff[0] = '\0';
766 }
767 /**
768 Set time and time_packed from a DATE value.
769 */
770 void set_date(MYSQL_TIME *ltime);
771 /**
772 Set time and time_packed from a TIME value.
773 */
774 void set_time(MYSQL_TIME *ltime, uint8 dec_arg);
775 /**
776 Set time and time_packed from a DATETIME value.
777 */
778 void set_datetime(MYSQL_TIME *ltime, uint8 dec_arg,
779 const Time_zone *tz = nullptr);
780 /**
781 Set time and time_packed according to DATE value
782 in "struct timeval" representation and its time zone.
783 */
784 void set_date(my_timeval tv, Time_zone *tz);
785 /**
786 Set time and time_packed according to TIME value
787 in "struct timeval" representation and its time zone.
788 */
789 void set_time(my_timeval tv, uint8 dec_arg, Time_zone *tz);
790 /**
791 Set time and time_packed according to DATETIME value
792 in "struct timeval" representation and its time zone.
793 */
794 void set_datetime(my_timeval tv, uint8 dec_arg, Time_zone *tz);
795 /**
796 Test if cached value is equal to another MYSQL_TIME_cache value.
797 */
798 bool eq(const MYSQL_TIME_cache &tm) const {
799 return val_packed() == tm.val_packed();
800 }
801
802 /**
803 Return number of decimal digits.
804 */
805 uint8 decimals() const {
807 return dec;
808 }
809
810 /**
811 Return packed representation.
812 */
815 return time_packed;
816 }
817 /**
818 Store MYSQL_TIME representation into the given date/datetime variable
819 checking date flags.
820 */
821 bool get_date(MYSQL_TIME *ltime, uint fuzzyflags) const;
822 /**
823 Store MYSQL_TIME representation into the given time variable.
824 */
825 bool get_time(MYSQL_TIME *ltime) const {
826 get_TIME(ltime);
827 return false;
828 }
829 /**
830 Return pointer to MYSQL_TIME representation.
831 */
834 return &time;
835 }
836 /**
837 Store string representation into String.
838 */
840 /**
841 Return C string representation.
842 */
843 const char *cptr() const { return string_buff; }
844};
845
846/**
847 DATE'2010-01-01'
848*/
849class Item_date_literal final : public Item_date_func {
851
852 public:
853 /**
854 Constructor for Item_date_literal.
855 @param ltime DATE value.
856 */
858 cached_time.set_date(ltime);
860 fixed = true;
861 }
862 const char *func_name() const override { return "date_literal"; }
863 void print(const THD *thd, String *str,
864 enum_query_type query_type) const override;
866 assert(fixed);
867 return cached_time.val_packed();
868 }
869 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override {
870 assert(fixed);
871 return cached_time.get_date(ltime, fuzzy_date);
872 }
873 String *val_str(String *str) override {
874 assert(fixed);
875 return cached_time.val_str(str);
876 }
877 bool resolve_type(THD *) override { return false; }
878 bool check_partition_func_processor(uchar *) override { return false; }
879 bool basic_const_item() const override { return true; }
880 table_map used_tables() const override { return 0; }
881 table_map not_null_tables() const override { return used_tables(); }
882 void cleanup() override { assert(marker == MARKER_NONE); }
883 bool eq_specific(const Item *item) const override;
884};
885
886/**
887 TIME'10:10:10'
888*/
889class Item_time_literal final : public Item_time_func {
891
892 public:
893 /**
894 Constructor for Item_time_literal.
895 @param ltime TIME value.
896 @param dec_arg number of fractional digits in ltime.
897 */
898 Item_time_literal(MYSQL_TIME *ltime, uint dec_arg) {
899 set_data_type_time(std::min(dec_arg, uint(DATETIME_MAX_DECIMALS)));
901 fixed = true;
902 }
903 const char *func_name() const override { return "time_literal"; }
904 void print(const THD *thd, String *str,
905 enum_query_type query_type) const override;
907 assert(fixed);
908 return cached_time.val_packed();
909 }
910 bool get_time(MYSQL_TIME *ltime) override {
911 assert(fixed);
912 return cached_time.get_time(ltime);
913 }
914 String *val_str(String *str) override {
915 assert(fixed);
916 return cached_time.val_str(str);
917 }
918 bool resolve_type(THD *) override { return false; }
919 bool check_partition_func_processor(uchar *) override { return false; }
920 bool basic_const_item() const override { return true; }
921 table_map used_tables() const override { return 0; }
922 table_map not_null_tables() const override { return used_tables(); }
923 void cleanup() override { assert(marker == MARKER_NONE); }
924 bool eq_specific(const Item *item) const override;
925};
926
927/**
928 TIMESTAMP'2001-01-01 10:20:30'
929*/
932
933 public:
934 /**
935 Constructor for Item_datetime_literal.
936 @param ltime DATETIME value.
937 @param dec_arg Number of fractional digits in ltime.
938 @param tz The current time zone, used for converting literals with
939 time zone upon storage.
940 */
941 Item_datetime_literal(MYSQL_TIME *ltime, uint dec_arg, const Time_zone *tz) {
942 set_data_type_datetime(std::min(dec_arg, uint{DATETIME_MAX_DECIMALS}));
944 fixed = true;
945 }
946 const char *func_name() const override { return "datetime_literal"; }
947 enum Functype functype() const override { return DATETIME_LITERAL; }
948 void print(const THD *thd, String *str,
949 enum_query_type query_type) const override;
951 assert(fixed);
952 return cached_time.val_packed();
953 }
954 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override {
955 assert(fixed);
956 return cached_time.get_date(ltime, fuzzy_date);
957 }
958 String *val_str(String *str) override {
959 assert(fixed);
960 return cached_time.val_str(str);
961 }
962 bool resolve_type(THD *) override { return false; }
963 bool check_partition_func_processor(uchar *) override { return false; }
964 bool basic_const_item() const override { return true; }
965 table_map used_tables() const override { return 0; }
966 table_map not_null_tables() const override { return used_tables(); }
967 void cleanup() override { assert(marker == MARKER_NONE); }
968 bool eq_specific(const Item *item) const override;
969};
970
971/**
972 This function implements the `AT TIME ZONE` operator, which casts a temporal
973 value to a temporal with time zone.
974
975 This function is hidden from the user except when used in a cast() operation,
976 the reason being that it adds time zone information to a temporal value, and
977 we don't currently have a type that corresponds to such a value. Hence the
978 only way to evaluate this function is by a concomitant cast to a temporal
979 without time zone designation. However, the value is not converted according
980 to the current time zone as is normally the case. For `TIMESTAMP`, this means
981 that the value is converted to the time zone given as argument to this
982 function rather than the session's time zone. And as we currently only support
983 the UTC time zone or the equivalent `INTERVAL '+00:00'`, so in practice the
984 value is not converted at all. This is a bit similar to the unix_timestamp()
985 function, but that one converts any argument (DATETIME, TIME) to UTC from the
986 session's time zone. This operator only accepts `TIMESTAMP` values.
987*/
989 public:
990 Item_func_at_time_zone(const POS &pos, Item *datetime,
991 const char *specifier_string, bool is_interval)
992 : Item_datetime_func(pos, datetime),
994 m_is_interval(is_interval) {}
995
996 bool resolve_type(THD *) override;
997
998 const char *func_name() const override { return "time_zone"; }
999
1000 bool set_time_zone(THD *thd);
1001
1002 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1003
1004 const char *specifier_string() const { return m_specifier_string; }
1005
1006 protected:
1007 bool check_type() const;
1008
1009 private:
1010 /// The time zone that the specifier string argument resolves to.
1011 const Time_zone *m_tz{nullptr};
1012
1013 /// The specifier string argument, not used after resolution.
1015
1016 /**
1017 Whether the syntax used the `INTERVAL` construction. We have no interval
1018 type.
1019 */
1021};
1022
1023/// Abstract CURTIME function. Children should define what time zone is used.
1026
1027 protected:
1028 // Abstract method that defines which time zone is used for conversion.
1029 virtual Time_zone *time_zone() = 0;
1030
1031 void add_json_info(Json_object *obj) override {
1032 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
1033 }
1034
1035 public:
1036 /**
1037 Constructor for Item_func_curtime.
1038 @param pos Position of token in the parser.
1039 @param dec_arg Number of fractional digits.
1040 */
1041 Item_func_curtime(const POS &pos, uint8 dec_arg) : Item_time_func(pos) {
1042 decimals = dec_arg;
1043 }
1044
1045 bool do_itemize(Parse_context *pc, Item **res) override;
1046
1047 /// This function must assign a new value for each execution
1049 return INNER_TABLE_BIT;
1050 }
1051
1052 bool resolve_type(THD *thd) override;
1053 longlong val_time_temporal() override;
1054 bool get_time(MYSQL_TIME *ltime) override;
1055 String *val_str(String *) override;
1056 bool check_function_as_value_generator(uchar *checker_args) override {
1058 pointer_cast<Check_function_as_value_generator_parameters *>(
1059 checker_args);
1060 func_arg->banned_function_name = func_name();
1061 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1062 (func_arg->source == VGS_CHECK_CONSTRAINT));
1063 }
1064};
1065
1067 protected:
1068 Time_zone *time_zone() override;
1069
1070 public:
1071 Item_func_curtime_local(const POS &pos, uint8 dec_arg)
1072 : Item_func_curtime(pos, dec_arg) {}
1073 const char *func_name() const override { return "curtime"; }
1074};
1075
1077 protected:
1078 Time_zone *time_zone() override;
1079
1080 public:
1081 Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
1082 : Item_func_curtime(pos, dec_arg) {}
1083 const char *func_name() const override { return "utc_time"; }
1084};
1085
1086/**
1087 Abstract CURDATE function.
1088
1089 @sa Item_func_curtime
1090 */
1093
1094 protected:
1095 virtual Time_zone *time_zone() = 0;
1096
1097 public:
1098 explicit Item_func_curdate(const POS &pos) : Item_date_func(pos) {}
1099
1100 bool do_itemize(Parse_context *pc, Item **res) override;
1101
1102 /// This function must assign a new value for each execution
1104 return INNER_TABLE_BIT;
1105 }
1106
1107 bool resolve_type(THD *) override;
1108 longlong val_date_temporal() override;
1109 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1110 String *val_str(String *) override;
1111 bool check_function_as_value_generator(uchar *checker_args) override {
1113 pointer_cast<Check_function_as_value_generator_parameters *>(
1114 checker_args);
1115 func_arg->banned_function_name = func_name();
1116 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1117 (func_arg->source == VGS_CHECK_CONSTRAINT));
1118 }
1119};
1120
1122 protected:
1123 Time_zone *time_zone() override;
1124
1125 public:
1126 explicit Item_func_curdate_local(const POS &pos) : Item_func_curdate(pos) {}
1127 const char *func_name() const override { return "curdate"; }
1128};
1129
1131 protected:
1132 Time_zone *time_zone() override;
1133
1134 public:
1136 const char *func_name() const override { return "utc_date"; }
1137};
1138
1139/**
1140 Abstract CURRENT_TIMESTAMP function.
1141
1142 @sa Item_func_curtime
1143*/
1145 protected:
1146 virtual Time_zone *time_zone() = 0;
1148 bool no_conversions) override;
1149
1150 void add_json_info(Json_object *obj) override {
1151 if (decimals > 0)
1152 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
1153 }
1154
1155 public:
1156 /**
1157 Constructor for Item_func_now.
1158 @param dec_arg Number of fractional digits.
1159 */
1161 Item_func_now(const POS &pos, uint8 dec_arg) : Item_datetime_func(pos) {
1162 decimals = dec_arg;
1163 }
1164
1165 /// This function must assign a new value for each execution
1167 return INNER_TABLE_BIT;
1168 }
1169
1170 bool resolve_type(THD *) override;
1171 longlong val_date_temporal() override;
1172 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1173 String *val_str(String *) override;
1174 bool check_function_as_value_generator(uchar *checker_args) override {
1176 pointer_cast<Check_function_as_value_generator_parameters *>(
1177 checker_args);
1178 func_arg->banned_function_name = func_name();
1179 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1180 (func_arg->source == VGS_CHECK_CONSTRAINT));
1181 }
1182};
1183
1185 protected:
1186 Time_zone *time_zone() override;
1187
1188 public:
1189 /**
1190 Stores the query start time in a field, truncating to the field's number
1191 of fractional second digits.
1192
1193 @param field The field to store in.
1194 */
1195 static void store_in(Field *field);
1196
1198 Item_func_now_local(const POS &pos, uint8 dec_arg)
1199 : Item_func_now(pos, dec_arg) {}
1200
1201 const char *func_name() const override { return "now"; }
1202 enum Functype functype() const override { return NOW_FUNC; }
1203};
1204
1205class Item_func_now_utc final : public Item_func_now {
1207
1208 protected:
1209 Time_zone *time_zone() override;
1210
1211 public:
1212 Item_func_now_utc(const POS &pos, uint8 dec_arg)
1213 : Item_func_now(pos, dec_arg) {}
1214
1215 bool do_itemize(Parse_context *pc, Item **res) override;
1216
1217 const char *func_name() const override { return "utc_timestamp"; }
1218};
1219
1220/**
1221 SYSDATE() is like NOW(), but always uses the real current time, not the
1222 query_start(). This matches the Oracle behavior.
1223*/
1225 public:
1227 decimals = dec_arg;
1228 }
1229 const char *func_name() const override { return "sysdate"; }
1230 bool resolve_type(THD *) override;
1231 enum Functype functype() const override { return SYSDATE_FUNC; }
1232 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1233 /**
1234 This function is non-deterministic and hence depends on the 'RAND'
1235 pseudo-table.
1236
1237 @retval Always RAND_TABLE_BIT
1238 */
1240 return RAND_TABLE_BIT;
1241 }
1242};
1243
1245 public:
1246 Item_func_from_days(const POS &pos, Item *a) : Item_date_func(pos, a) {}
1247 const char *func_name() const override { return "from_days"; }
1248 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1249 bool check_partition_func_processor(uchar *) override { return false; }
1250 enum Functype functype() const override { return FROM_DAYS_FUNC; }
1252 return has_date_args() || has_time_args();
1253 }
1254 bool resolve_type(THD *thd) override {
1255 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
1256 if (reject_vector_args()) return true;
1257 return Item_date_func::resolve_type(thd);
1258 }
1259};
1260
1263 const bool is_time_format;
1265
1266 public:
1268 bool is_time_format_arg = false)
1269 : Item_str_func(pos, a, b), is_time_format(is_time_format_arg) {}
1270 String *val_str(String *str) override;
1271 const char *func_name() const override {
1272 return is_time_format ? "time_format" : "date_format";
1273 }
1274 bool resolve_type(THD *thd) override;
1275 uint format_length(const String *format);
1276 bool eq_specific(const Item *item) const override;
1277};
1278
1280 public:
1282 : Item_datetime_func(pos, a) {}
1283 const char *func_name() const override { return "from_unixtime"; }
1284 enum Functype functype() const override { return FROM_UNIXTIME_FUNC; }
1285 bool resolve_type(THD *thd) override;
1286 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1287};
1288
1289/*
1290 This class represents CONVERT_TZ() function.
1291 The important fact about this function that it is handled in special way.
1292 When such function is met in expression time_zone system tables are added
1293 to global list of tables to open, so later those already opened and locked
1294 tables can be used during this function calculation for loading time zone
1295 descriptions.
1296*/
1298 /*
1299 If time zone parameters are constants we are caching objects that
1300 represent them (we use separate from_tz_cached/to_tz_cached members
1301 to indicate this fact, since NULL is legal value for from_tz/to_tz
1302 members.
1303 */
1306
1307 public:
1308 Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
1309 : Item_datetime_func(pos, a, b, c),
1310 from_tz_cached(false),
1311 to_tz_cached(false) {}
1312 const char *func_name() const override { return "convert_tz"; }
1313 enum Functype functype() const override { return CONVERT_TZ_FUNC; }
1314 bool resolve_type(THD *) override;
1315 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1316 void cleanup() override;
1317};
1318
1320 public:
1321 Item_func_sec_to_time(const POS &pos, Item *item)
1322 : Item_time_func(pos, item) {}
1323 bool resolve_type(THD *thd) override {
1324 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_NEWDECIMAL)) return true;
1325 if (reject_vector_args()) return true;
1327 std::min(args[0]->decimals, uint8{DATETIME_MAX_DECIMALS}));
1328 set_nullable(true);
1329 return false;
1330 }
1331 const char *func_name() const override { return "sec_to_time"; }
1332 enum Functype functype() const override { return SEC_TO_TIME_FUNC; }
1333 bool get_time(MYSQL_TIME *ltime) override;
1334};
1335
1336extern const char *interval_names[];
1337
1338/**
1339 Implementation class for the DATE_ADD and DATE_SUB functions.
1340 Also used for the synonym functions ADDDATE and SUBDATE.
1341*/
1344
1345 public:
1347 bool subtract)
1348 : Item_temporal_hybrid_func(pos, a, b),
1350 m_subtract(subtract) {}
1351 /**
1352 POS-less ctor for post-parse construction with implicit addition to THD's
1353 free_list (see Item::Item() no-argument ctor).
1354 */
1358 m_subtract(subtract) {}
1359 const char *func_name() const override { return "date_add_interval"; }
1360 enum Functype functype() const override { return DATEADD_FUNC; }
1361 bool resolve_type(THD *) override;
1362 bool eq_specific(const Item *item) const override;
1363 void print(const THD *thd, String *str,
1364 enum_query_type query_type) const override;
1366 bool is_subtract() const { return m_subtract; }
1367
1368 protected:
1369 void add_json_info(Json_object *obj) override;
1370
1371 private:
1372 bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1373 bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date);
1374 bool get_time_internal(MYSQL_TIME *res);
1375
1376 /// The type of the interval argument
1378 /// False if function is DATE_ADD, true if function is DATE_SUB
1379 const bool m_subtract;
1381};
1382
1383class Item_extract final : public Item_int_func {
1385
1386 public:
1387 const interval_type int_type; // keep it public
1388 Item_extract(const POS &pos, interval_type type_arg, Item *a)
1389 : Item_int_func(pos, a), int_type(type_arg) {}
1390 longlong val_int() override;
1391 enum Functype functype() const override { return EXTRACT_FUNC; }
1392 const char *func_name() const override { return "extract"; }
1393 bool resolve_type(THD *) override;
1394 bool eq_specific(const Item *item) const override;
1395 void print(const THD *thd, String *str,
1396 enum_query_type query_type) const override;
1397 bool check_partition_func_processor(uchar *) override { return false; }
1399 switch (int_type) {
1400 case INTERVAL_YEAR:
1402 case INTERVAL_QUARTER:
1403 case INTERVAL_MONTH:
1404 /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
1405 case INTERVAL_DAY:
1406 return !has_date_args();
1407 case INTERVAL_DAY_HOUR:
1411 return !has_datetime_args();
1412 case INTERVAL_HOUR:
1415 case INTERVAL_MINUTE:
1417 case INTERVAL_SECOND:
1422 return !has_time_args();
1423 default:
1424 /*
1425 INTERVAL_LAST is only an end marker,
1426 INTERVAL_WEEK depends on default_week_format which is a session
1427 variable and cannot be used for partitioning. See bug#57071.
1428 */
1429 break;
1430 }
1431 return true;
1432 }
1433};
1434
1437
1438 public:
1439 Item_typecast_date(Item *a, bool explicit_cast)
1440 : Item_date_func(a), m_explicit_cast(explicit_cast) {
1441 set_nullable(true);
1442 }
1443 Item_typecast_date(const POS &pos, Item *a) : Item_date_func(pos, a) {
1444 set_nullable(true);
1445 }
1446
1447 bool resolve_type(THD *thd) override {
1448 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATE, false, true)) return true;
1449 if (reject_vector_args()) return true;
1450 return Item_date_func::resolve_type(thd);
1451 }
1452 void print(const THD *thd, String *str,
1453 enum_query_type query_type) const override;
1454 const char *func_name() const override { return "cast_as_date"; }
1455 enum Functype functype() const override { return TYPECAST_FUNC; }
1456 bool is_explicit_cast() const { return m_explicit_cast; }
1457 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1458 const char *cast_type() const { return "date"; }
1459};
1460
1464
1465 public:
1468 }
1469 Item_typecast_time(const POS &pos, Item *a) : Item_time_func(pos, a) {
1471 }
1472 Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
1473 : Item_time_func(pos, a) {
1475 decimals = dec_arg;
1476 }
1479 decimals = dec_arg;
1480 }
1481 void print(const THD *thd, String *str,
1482 enum_query_type query_type) const override;
1483 const char *func_name() const override { return "cast_as_time"; }
1484 enum Functype functype() const override { return TYPECAST_FUNC; }
1485 bool is_explicit_cast() const { return m_explicit_cast; }
1486 bool get_time(MYSQL_TIME *ltime) override;
1487 const char *cast_type() const { return "time"; }
1488 bool resolve_type(THD *thd) override {
1489 if (reject_vector_args()) return true;
1490 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATETIME, false, true))
1491 return true;
1493 : decimals);
1494 set_nullable(true);
1495 return false;
1496 }
1497};
1498
1502
1503 public:
1504 Item_typecast_datetime(Item *a, bool explicit_cast)
1505 : Item_datetime_func(a), m_explicit_cast(explicit_cast) {
1507 }
1510 }
1511 Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
1512 : Item_datetime_func(pos, a) {
1514 decimals = dec_arg;
1515 }
1518 decimals = dec_arg;
1519 }
1520 void print(const THD *thd, String *str,
1521 enum_query_type query_type) const override;
1522 const char *func_name() const override { return "cast_as_datetime"; }
1523 enum Functype functype() const override { return TYPECAST_FUNC; }
1524 const char *cast_type() const { return "datetime"; }
1525 bool is_explicit_cast() const { return m_explicit_cast; }
1526 bool resolve_type(THD *thd) override {
1527 if (reject_vector_args()) return true;
1528 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATETIME, false, true))
1529 return true;
1532 set_nullable(true);
1533 return false;
1534 }
1535 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1536};
1537
1539 public:
1540 Item_func_makedate(const POS &pos, Item *a, Item *b)
1541 : Item_date_func(pos, a, b) {
1542 set_nullable(true);
1543 }
1544 const char *func_name() const override { return "makedate"; }
1545 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1546 enum Functype functype() const override { return MAKEDATE_FUNC; }
1547 bool resolve_type(THD *thd) override {
1548 if (reject_vector_args()) return true;
1549 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_LONGLONG)) return true;
1550 return Item_date_func::resolve_type(thd);
1551 }
1552};
1553
1554/**
1555 Add a time expression to a temporal expression, or
1556 subtract a time expression from a temporal expression.
1557 Used to implement the functions ADDTIME and SUBTIME, and the
1558 two-argument version of TIMESTAMP (which sets m_datetime = true).
1559*/
1561 const bool m_datetime; ///< True if first argument expected to be datetime
1562 int m_sign; ///< +1 for ADD, -1 for SUBTRACT
1563
1564 bool val_datetime(MYSQL_TIME *time, my_time_flags_t fuzzy_date) override;
1565
1566 public:
1567 Item_func_add_time(Item *a, Item *b, bool datetime, bool negate)
1569 m_datetime(datetime),
1570 m_sign(negate ? -1 : 1) {}
1571 Item_func_add_time(const POS &pos, Item *a, Item *b, bool datetime,
1572 bool negate)
1573 : Item_temporal_hybrid_func(pos, a, b),
1574 m_datetime(datetime),
1575 m_sign(negate ? -1 : 1) {}
1576
1577 Item_func_add_time(const POS &pos, Item *a, Item *b)
1578 : Item_func_add_time(pos, a, b, false, false) {}
1579
1580 bool resolve_type(THD *) override;
1581 void print(const THD *thd, String *str,
1582 enum_query_type query_type) const override;
1583 const char *func_name() const override { return "add_time"; }
1584 enum Functype functype() const override { return ADDTIME_FUNC; }
1585 int sign() const { return m_sign; }
1586};
1587
1589 public:
1590 Item_func_timediff(const POS &pos, Item *a, Item *b)
1591 : Item_time_func(pos, a, b) {}
1592 const char *func_name() const override { return "timediff"; }
1593 enum Functype functype() const override { return TIMEDIFF_FUNC; }
1594 bool resolve_type(THD *thd) override {
1595 if (reject_vector_args()) return true;
1596 /*
1597 This function can operate on two TIME, or on two DATETIME (no mix).
1598 We infer the type from the other argument. If both arguments are '?', we
1599 choose VARCHAR; indeed, if we chose TIME and get DATETIME, we risk
1600 cutting the date part, and if we chose DATETIME and get TIME, we risk
1601 interpreting "01:01:01" as "2001:01:01 00:00:00".
1602 */
1603 if (param_type_uses_non_param(thd)) return true;
1605 std::max(args[0]->time_precision(), args[1]->time_precision()));
1606 set_nullable(true);
1607 return false;
1608 }
1609 bool get_time(MYSQL_TIME *ltime) override;
1610};
1611
1613 public:
1614 Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
1615 : Item_time_func(pos, a, b, c) {
1616 set_nullable(true);
1617 }
1618 bool resolve_type(THD *thd) override {
1619 if (reject_vector_args()) return true;
1620 if (param_type_is_default(thd, 0, 2, MYSQL_TYPE_LONGLONG)) return true;
1621 if (param_type_is_default(thd, 2, 3, MYSQL_TYPE_NEWDECIMAL)) return true;
1623 std::min(args[2]->decimals, uint8{DATETIME_MAX_DECIMALS}));
1624 return false;
1625 }
1626 const char *func_name() const override { return "maketime"; }
1627 enum Functype functype() const override { return MAKETIME_FUNC; }
1628 bool get_time(MYSQL_TIME *ltime) override;
1629};
1630
1632 public:
1633 Item_func_microsecond(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1634 longlong val_int() override;
1635 const char *func_name() const override { return "microsecond"; }
1636 enum Functype functype() const override { return MICROSECOND_FUNC; }
1637 bool resolve_type(THD *thd) override;
1638 bool check_partition_func_processor(uchar *) override { return false; }
1640 return !has_time_args();
1641 }
1642};
1643
1646
1647 public:
1649 interval_type type_arg)
1650 : Item_int_func(pos, a, b), int_type(type_arg) {}
1651 const char *func_name() const override { return "timestampdiff"; }
1652 enum Functype functype() const override { return TIMESTAMPDIFF_FUNC; }
1654 longlong val_int() override;
1655 bool resolve_type(THD *thd) override {
1656 if (reject_vector_args()) return true;
1657 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_DATETIME)) return true;
1658 set_nullable(true);
1659 return false;
1660 }
1661 void print(const THD *thd, String *str,
1662 enum_query_type query_type) const override;
1663};
1664
1672
1674 public:
1675 const enum_mysql_timestamp_type type; // keep it public
1677 Item *a)
1678 : Item_str_ascii_func(pos, a), type(type_arg) {}
1679 String *val_str_ascii(String *str) override;
1680 const char *func_name() const override { return "get_format"; }
1681 enum Functype functype() const override { return GET_FORMAT_FUNC; }
1682 bool resolve_type(THD *thd) override {
1683 if (reject_vector_args()) return true;
1684 if (param_type_is_default(thd, 0, -1)) return true;
1685 set_nullable(true);
1687 return false;
1688 }
1689 void print(const THD *thd, String *str,
1690 enum_query_type query_type) const override;
1691
1693};
1694
1697 void fix_from_format(const char *format, size_t length);
1698
1699 protected:
1700 bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1701
1702 public:
1704 : Item_temporal_hybrid_func(pos, a, b) {}
1705 const char *func_name() const override { return "str_to_date"; }
1706 bool resolve_type(THD *) override;
1707};
1708
1710 public:
1711 Item_func_last_day(const POS &pos, Item *a) : Item_date_func(pos, a) {
1712 set_nullable(true);
1713 }
1714 const char *func_name() const override { return "last_day"; }
1715 enum Functype functype() const override { return LAST_DAY_FUNC; }
1716 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1717 bool resolve_type(THD *thd) override {
1718 if (reject_vector_args()) return true;
1719 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_DATETIME)) return true;
1720 return Item_date_func::resolve_type(thd);
1721 }
1722};
1723
1725 public:
1727 : Item_datetime_func(pos, list) {}
1728 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1729 const char *func_name() const override { return "internal_update_time"; }
1730 bool resolve_type(THD *thd) override;
1731 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1732};
1733
1735 public:
1737 : Item_datetime_func(pos, list) {}
1738 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1739 const char *func_name() const override { return "internal_check_time"; }
1740 bool resolve_type(THD *thd) override;
1741 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1742};
1743
1744/* Function prototypes */
1745
1746bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time,
1748
1749#endif /* ITEM_TIMEFUNC_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
void set_numeric()
Definition: item.h:221
const CHARSET_INFO * collation
Definition: item.h:187
Definition: field.h:577
Implementation class for the DATE_ADD and DATE_SUB functions.
Definition: item_timefunc.h:1342
enum Functype functype() const override
Definition: item_timefunc.h:1360
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2704
const bool m_subtract
False if function is DATE_ADD, true if function is DATE_SUB.
Definition: item_timefunc.h:1379
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:2671
Item_temporal_hybrid_func super
Definition: item_timefunc.h:1343
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:2664
const char * func_name() const override
Definition: item_timefunc.h:1359
bool is_subtract() const
Definition: item_timefunc.h:1366
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.cc:2715
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2484
bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date)
Definition: item_timefunc.cc:2576
const interval_type m_interval_type
The type of the interval argument.
Definition: item_timefunc.h:1377
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:1355
interval_type get_interval_type() const
Definition: item_timefunc.h:1365
String value
Definition: item_timefunc.h:1380
bool get_time_internal(MYSQL_TIME *res)
Definition: item_timefunc.cc:2611
Item_date_add_interval(const POS &pos, Item *a, Item *b, interval_type type, bool subtract)
Definition: item_timefunc.h:1346
Abstract class for functions returning DATE values.
Definition: item_timefunc.h:595
double val_real() override
Definition: item_timefunc.h:620
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override=0
const char * func_name() const override
Definition: item_timefunc.h:621
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:623
enum Functype functype() const override
Definition: item_timefunc.h:622
Item_date_func(const POS &pos)
Definition: item_timefunc.h:603
Item_date_func()
Definition: item_timefunc.h:602
Item_date_func(Item *a)
Definition: item_timefunc.h:606
Item_date_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:610
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:932
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:614
longlong val_int() override
Definition: item_timefunc.h:618
Item_date_func(const POS &pos, Item *a)
Definition: item_timefunc.h:607
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:597
String * val_str(String *str) override
Definition: item_timefunc.h:617
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:624
DATE'2010-01-01'.
Definition: item_timefunc.h:849
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:879
Item_date_literal(MYSQL_TIME *ltime)
Constructor for Item_date_literal.
Definition: item_timefunc.h:857
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.h:869
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:877
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:953
const char * func_name() const override
Definition: item_timefunc.h:862
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:948
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:865
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:850
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.h:882
table_map used_tables() const override
Definition: item_timefunc.h:880
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:878
String * val_str(String *str) override
Definition: item_timefunc.h:873
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:881
Abstract class for functions returning DATETIME values.
Definition: item_timefunc.h:637
longlong val_int() override
Definition: item_timefunc.h:680
Item_datetime_func(Item *a)
Definition: item_timefunc.h:650
Item_datetime_func(const POS &pos)
Definition: item_timefunc.h:647
Item_datetime_func()
Definition: item_timefunc.h:644
String * val_str(String *str) override
Definition: item_timefunc.h:677
double val_real() override
Definition: item_timefunc.h:676
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:940
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:686
Item_datetime_func(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:671
Item_datetime_func(Item *a, Item *b, Item *c)
Definition: item_timefunc.h:660
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:639
Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:663
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:667
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:682
Item_datetime_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:656
Item_datetime_func(const POS &pos, Item *a)
Definition: item_timefunc.h:653
TIMESTAMP'2001-01-01 10:20:30'.
Definition: item_timefunc.h:930
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:931
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:964
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:962
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:966
enum Functype functype() const override
Definition: item_timefunc.h:947
const char * func_name() const override
Definition: item_timefunc.h:946
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.h:967
Item_datetime_literal(MYSQL_TIME *ltime, uint dec_arg, const Time_zone *tz)
Constructor for Item_datetime_literal.
Definition: item_timefunc.h:941
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:963
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:964
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.h:954
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:959
String * val_str(String *str) override
Definition: item_timefunc.h:958
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:950
table_map used_tables() const override
Definition: item_timefunc.h:965
Definition: item_timefunc.h:1383
bool date_value
Definition: item_timefunc.h:1384
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1398
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2722
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:2901
const char * func_name() const override
Definition: item_timefunc.h:1392
enum Functype functype() const override
Definition: item_timefunc.h:1391
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2731
longlong val_int() override
Definition: item_timefunc.cc:2823
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1397
const interval_type int_type
Definition: item_timefunc.h:1387
Item_extract(const POS &pos, interval_type type_arg, Item *a)
Definition: item_timefunc.h:1388
Add a time expression to a temporal expression, or subtract a time expression from a temporal express...
Definition: item_timefunc.h:1560
int m_sign
+1 for ADD, -1 for SUBTRACT
Definition: item_timefunc.h:1562
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3042
const char * func_name() const override
Definition: item_timefunc.h:1583
Item_func_add_time(Item *a, Item *b, bool datetime, bool negate)
Definition: item_timefunc.h:1567
const bool m_datetime
True if first argument expected to be datetime.
Definition: item_timefunc.h:1561
int sign() const
Definition: item_timefunc.h:1585
enum Functype functype() const override
Definition: item_timefunc.h:1584
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:3087
Item_func_add_time(const POS &pos, Item *a, Item *b, bool datetime, bool negate)
Definition: item_timefunc.h:1571
Item_func_add_time(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1577
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3156
This function implements the AT TIME ZONE operator, which casts a temporal value to a temporal with t...
Definition: item_timefunc.h:988
bool check_type() const
Definition: item_timefunc.cc:1030
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:982
bool set_time_zone(THD *thd)
Definition: item_timefunc.cc:994
const char * func_name() const override
Definition: item_timefunc.h:998
bool m_is_interval
Whether the syntax used the INTERVAL construction.
Definition: item_timefunc.h:1020
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:1005
const char * m_specifier_string
The specifier string argument, not used after resolution.
Definition: item_timefunc.h:1014
const Time_zone * m_tz
The time zone that the specifier string argument resolves to.
Definition: item_timefunc.h:1011
const char * specifier_string() const
Definition: item_timefunc.h:1004
Item_func_at_time_zone(const POS &pos, Item *datetime, const char *specifier_string, bool is_interval)
Definition: item_timefunc.h:990
Definition: item_timefunc.h:1297
const char * func_name() const override
Definition: item_timefunc.h:1312
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2440
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2431
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.cc:2478
Time_zone * from_tz
Definition: item_timefunc.h:1305
Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1308
bool from_tz_cached
Definition: item_timefunc.h:1304
bool to_tz_cached
Definition: item_timefunc.h:1304
enum Functype functype() const override
Definition: item_timefunc.h:1313
Time_zone * to_tz
Definition: item_timefunc.h:1305
Definition: item_timefunc.h:1121
Time_zone * time_zone() override
Definition: item_timefunc.cc:2010
const char * func_name() const override
Definition: item_timefunc.h:1127
Item_func_curdate_local(const POS &pos)
Definition: item_timefunc.h:1126
Definition: item_timefunc.h:1130
Time_zone * time_zone() override
Definition: item_timefunc.cc:2014
Item_func_curdate_utc(const POS &pos)
Definition: item_timefunc.h:1135
const char * func_name() const override
Definition: item_timefunc.h:1136
Abstract CURDATE function.
Definition: item_timefunc.h:1091
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2005
Item_date_func super
Definition: item_timefunc.h:1092
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:2016
String * val_str(String *) override
Definition: item_timefunc.cc:2030
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:1111
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:2023
Item_func_curdate(const POS &pos)
Definition: item_timefunc.h:1098
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1998
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1103
Definition: item_timefunc.h:1066
Item_func_curtime_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1071
const char * func_name() const override
Definition: item_timefunc.h:1073
Time_zone * time_zone() override
Definition: item_timefunc.cc:2095
Definition: item_timefunc.h:1076
Time_zone * time_zone() override
Definition: item_timefunc.cc:2099
const char * func_name() const override
Definition: item_timefunc.h:1083
Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1081
Abstract CURTIME function. Children should define what time zone is used.
Definition: item_timefunc.h:1024
virtual Time_zone * time_zone()=0
String * val_str(String *) override
Definition: item_timefunc.cc:2082
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1048
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2051
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2074
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:1056
Item_func_curtime(const POS &pos, uint8 dec_arg)
Constructor for Item_func_curtime.
Definition: item_timefunc.h:1041
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2044
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:1031
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.cc:2066
Item_time_func super
Definition: item_timefunc.h:1025
Definition: item_timefunc.h:1261
const bool is_time_format
Definition: item_timefunc.h:1263
int fixed_length
Definition: item_timefunc.h:1262
const char * func_name() const override
Definition: item_timefunc.h:1271
String * val_str(String *str) override
Definition: item_timefunc.cc:2327
Item_func_date_format(const POS &pos, Item *a, Item *b, bool is_time_format_arg=false)
Definition: item_timefunc.h:1267
String value
Definition: item_timefunc.h:1264
uint format_length(const String *format)
Definition: item_timefunc.cc:2257
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2209
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:2238
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:1490
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:1502
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:1247
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:1258
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:1228
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:197
longlong val_int() override
Definition: item_timefunc.cc:1239
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:1244
const char * func_name() const override
Definition: item_timefunc.h:1247
Item_func_from_days(const POS &pos, Item *a)
Definition: item_timefunc.h:1246
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1251
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1254
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1249
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:1904
enum Functype functype() const override
Definition: item_timefunc.h:1250
Definition: item_timefunc.h:1279
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2378
const char * func_name() const override
Definition: item_timefunc.h:1283
Item_func_from_unixtime(const POS &pos, Item *a)
Definition: item_timefunc.h:1281
enum Functype functype() const override
Definition: item_timefunc.h:1284
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2369
Definition: item_timefunc.h:1673
String * val_str_ascii(String *str) override
Definition: item_timefunc.cc:3466
const char * func_name() const override
Definition: item_timefunc.h:1680
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3493
enum Functype functype() const override
Definition: item_timefunc.h:1681
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1682
enum_mysql_timestamp_type timestamp_type() const
Definition: item_timefunc.h:1692
Item_func_get_format(const POS &pos, enum_mysql_timestamp_type type_arg, Item *a)
Definition: item_timefunc.h:1676
const enum_mysql_timestamp_type type
Definition: item_timefunc.h:1675
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:1329
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:210
longlong val_int() override
Definition: item_timefunc.cc:1339
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:1734
enum Functype functype() const override
Definition: item_timefunc.h:1738
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3775
const char * func_name() const override
Definition: item_timefunc.h:1739
Item_func_internal_check_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1736
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3767
Definition: item_timefunc.h:1724
const char * func_name() const override
Definition: item_timefunc.h:1729
enum Functype functype() const override
Definition: item_timefunc.h:1728
Item_func_internal_update_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1726
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3688
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3696
Definition: item_timefunc.h:1709
Item_func_last_day(const POS &pos, Item *a)
Definition: item_timefunc.h:1711
const char * func_name() const override
Definition: item_timefunc.h:1714
enum Functype functype() const override
Definition: item_timefunc.h:1715
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1717
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3664
Definition: item_timefunc.h:1538
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1547
enum Functype functype() const override
Definition: item_timefunc.h:1546
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:3013
Item_func_makedate(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1540
const char * func_name() const override
Definition: item_timefunc.h:1544
Definition: item_timefunc.h:1612
enum Functype functype() const override
Definition: item_timefunc.h:1627
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1618
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:3240
Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1614
const char * func_name() const override
Definition: item_timefunc.h:1626
Definition: item_timefunc.h:1631
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1639
longlong val_int() override
MICROSECOND(a) is a function ( extraction) that extracts the microseconds from a.
Definition: item_timefunc.cc:3313
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3319
enum Functype functype() const override
Definition: item_timefunc.h:1636
Item_func_microsecond(const POS &pos, Item *a)
Definition: item_timefunc.h:1633
const char * func_name() const override
Definition: item_timefunc.h:1635
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1638
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:1345
const char * func_name() const override
Definition: item_timefunc.h:219
longlong val_int() override
Definition: item_timefunc.cc:1355
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:1264
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:1275
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:1281
Definition: item_timefunc.h:1184
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:2111
Time_zone * time_zone() override
Definition: item_timefunc.cc:2118
const char * func_name() const override
Definition: item_timefunc.h:1201
Item_func_now_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1198
enum Functype functype() const override
Definition: item_timefunc.h:1202
Item_func_now_local(uint8 dec_arg)
Definition: item_timefunc.h:1197
Definition: item_timefunc.h:1205
const char * func_name() const override
Definition: item_timefunc.h:1217
Item_func_now_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1212
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2120
Item_func_now super
Definition: item_timefunc.h:1206
Time_zone * time_zone() override
Definition: item_timefunc.cc:2127
Abstract CURRENT_TIMESTAMP function.
Definition: item_timefunc.h:1144
Item_func_now(uint8 dec_arg)
Constructor for Item_func_now.
Definition: item_timefunc.h:1160
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:2158
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:2129
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2103
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:1174
String * val_str(String *) override
Definition: item_timefunc.cc:2145
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:1150
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1166
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:2137
Item_func_now(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1161
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:1044
longlong val_int() override
Definition: item_timefunc.cc:1049
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:1063
longlong val_int() override
Definition: item_timefunc.cc:1068
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:1322
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:1319
const char * func_name() const override
Definition: item_timefunc.h:1331
Item_func_sec_to_time(const POS &pos, Item *item)
Definition: item_timefunc.h:1321
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1323
enum Functype functype() const override
Definition: item_timefunc.h:1332
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2190
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:1361
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:1374
Definition: item_timefunc.h:1695
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3580
Item_func_str_to_date(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1703
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:3614
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:3530
const char * func_name() const override
Definition: item_timefunc.h:1705
enum_mysql_timestamp_type cached_timestamp_type
Definition: item_timefunc.h:1696
SYSDATE() is like NOW(), but always uses the real current time, not the query_start().
Definition: item_timefunc.h:1224
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:1239
const char * func_name() const override
Definition: item_timefunc.h:1229
Item_func_sysdate_local(uint8 dec_arg)
Definition: item_timefunc.h:1226
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2184
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:2171
enum Functype functype() const override
Definition: item_timefunc.h:1231
Definition: item_timefunc.h:464
enum Functype functype() const override
Definition: item_timefunc.h:470
longlong val_int() override
Definition: item_timefunc.cc:1738
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:472
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1730
Item_func_time_to_sec(const POS &pos, Item *item)
Definition: item_timefunc.h:466
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:473
const char * func_name() const override
Definition: item_timefunc.h:469
Definition: item_timefunc.h:1588
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:3184
enum Functype functype() const override
Definition: item_timefunc.h:1593
Item_func_timediff(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1590
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1594
const char * func_name() const override
Definition: item_timefunc.h:1592
Definition: item_timefunc.h:1644
interval_type intervaltype() const
Definition: item_timefunc.h:1653
const char * func_name() const override
Definition: item_timefunc.h:1651
enum Functype functype() const override
Definition: item_timefunc.h:1652
longlong val_int() override
Definition: item_timefunc.cc:3326
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3422
Item_func_timestamp_diff(const POS &pos, Item *a, Item *b, interval_type type_arg)
Definition: item_timefunc.h:1648
const interval_type int_type
Definition: item_timefunc.h:1645
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1655
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:1083
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:1097
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:1179
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1160
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:1170
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:1127
longlong val_int() override
Definition: item_timefunc.cc:1134
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:1104
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:1721
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:451
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:1714
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1691
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:1702
Definition: item_timefunc.h:254
const char * func_name() const override
Definition: item_timefunc.h:264
longlong val_int() override
Definition: item_timefunc.cc:1440
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1386
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:1397
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:1469
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:1479
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:1635
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1627
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:1524
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:1516
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:1448
enum Functype functype() const override
Definition: item_timefunc.h:275
longlong val_int() override
Definition: item_timefunc.cc:1459
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:100
bool param_type_uses_non_param(THD *thd, enum_field_types def=MYSQL_TYPE_VARCHAR)
Definition: item_func.cc:617
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
bool reject_vector_args()
Definition: item_func.cc:1600
Functype
Definition: item_func.h:209
@ DATEADD_FUNC
Definition: item_func.h:316
@ YEAR_FUNC
Definition: item_func.h:296
@ HOUR_FUNC
Definition: item_func.h:307
@ TIME_TO_SEC_FUNC
Definition: item_func.h:321
@ PERIODDIFF_FUNC
Definition: item_func.h:337
@ FROM_UNIXTIME_FUNC
Definition: item_func.h:317
@ MAKETIME_FUNC
Definition: item_func.h:299
@ NOW_FUNC
Definition: item_func.h:251
@ FROM_DAYS_FUNC
Definition: item_func.h:252
@ CONVERT_TZ_FUNC
Definition: item_func.h:318
@ DD_INTERNAL_FUNC
Definition: item_func.h:266
@ DAY_FUNC
Definition: item_func.h:302
@ MAKEDATE_FUNC
Definition: item_func.h:298
@ SEC_TO_TIME_FUNC
Definition: item_func.h:338
@ DATE_FUNC
Definition: item_func.h:306
@ TIMESTAMPDIFF_FUNC
Definition: item_func.h:322
@ SECOND_FUNC
Definition: item_func.h:309
@ PERIODADD_FUNC
Definition: item_func.h:336
@ EXTRACT_FUNC
Definition: item_func.h:257
@ MONTH_FUNC
Definition: item_func.h:300
@ TO_SECONDS_FUNC
Definition: item_func.h:305
@ MICROSECOND_FUNC
Definition: item_func.h:310
@ QUARTER_FUNC
Definition: item_func.h:313
@ TIMEDIFF_FUNC
Definition: item_func.h:335
@ SYSDATE_FUNC
Definition: item_func.h:334
@ MONTHNAME_FUNC
Definition: item_func.h:301
@ TYPECAST_FUNC
Definition: item_func.h:258
@ LAST_DAY_FUNC
Definition: item_func.h:319
@ WEEKDAY_FUNC
Definition: item_func.h:315
@ ADDTIME_FUNC
Definition: item_func.h:312
@ DAYOFYEAR_FUNC
Definition: item_func.h:311
@ GET_FORMAT_FUNC
Definition: item_func.h:339
@ DAYNAME_FUNC
Definition: item_func.h:303
@ DATETIME_LITERAL
Definition: item_func.h:323
@ MINUTE_FUNC
Definition: item_func.h:308
@ TO_DAYS_FUNC
Definition: item_func.h:304
@ WEEK_FUNC
Definition: item_func.h:314
@ YEARWEEK_FUNC
Definition: item_func.h:297
@ UNIX_TIMESTAMP_FUNC
Definition: item_func.h:320
virtual const char * func_name() const =0
bool has_timestamp_args()
Definition: item_func.h:660
enum Type type() const override
Definition: item_func.h:363
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:528
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:504
bool has_date_args()
Definition: item_func.h:670
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:130
bool has_time_args()
Definition: item_func.h:681
bool has_datetime_args()
Definition: item_func.h:692
Definition: item_func.h:1019
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:150
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:482
Item_temporal_func()
Definition: item_timefunc.h:493
Item_temporal_func(const POS &pos, Item *a)
Definition: item_timefunc.h:497
Item_temporal_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:499
Item_temporal_func(const POS &pos)
Definition: item_timefunc.h:494
Item_temporal_func(Item *a)
Definition: item_timefunc.h:496
Item_temporal_func(Item *a, Item *b, Item *c)
Definition: item_timefunc.h:501
Field * tmp_table_field(TABLE *table) override
Definition: item_timefunc.h:513
Item_temporal_func(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:506
bool check_precision()
Definition: item_timefunc.cc:807
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:487
Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:502
Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_timefunc.h:504
uint datetime_precision() override
DATETIME precision of the item: 0..6.
Definition: item_timefunc.h:520
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:827
uint time_precision() override
TIME precision of the item: 0..6.
Definition: item_timefunc.h:516
const CHARSET_INFO * charset_for_protocol() override
Definition: item_timefunc.h:510
Item_result result_type() const override
Definition: item_timefunc.h:509
Abstract class for functions returning TIME, DATE, DATETIME or string values, whose data type depends...
Definition: item_timefunc.h:532
const CHARSET_INFO * charset_for_protocol() override
Definition: item_timefunc.h:557
Field * tmp_table_field(TABLE *table) override
Definition: item_timefunc.h:568
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.cc:856
sql_mode_t sql_mode
Definition: item_timefunc.h:534
double val_real() override
Definition: item_timefunc.h:572
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:546
Item_result result_type() const override
Definition: item_timefunc.h:556
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:891
Item_temporal_hybrid_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:553
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:551
String * val_str(String *str) override
Return string value in @character_set_connection.
Definition: item_timefunc.h:581
String * val_str_ascii(String *str) override
Return string value in ASCII character set.
Definition: item_timefunc.cc:902
longlong val_int() override
Definition: item_timefunc.h:571
String ascii_buf
Definition: item_timefunc.h:535
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:849
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.cc:877
Abstract class for functions returning TIME values.
Definition: item_timefunc.h:698
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:700
longlong val_int() override
Definition: item_timefunc.h:728
String * val_str(String *str) override
Definition: item_timefunc.h:733
Item_time_func(const POS &pos, Item *a)
Definition: item_timefunc.h:712
Item_time_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:719
Item_time_func(Item *a)
Definition: item_timefunc.h:709
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.cc:926
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:724
Item_time_func(const POS &pos)
Definition: item_timefunc.h:706
bool get_time(MYSQL_TIME *res) override=0
double val_real() override
Definition: item_timefunc.h:723
Item_time_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:715
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.h:730
Item_time_func()
Definition: item_timefunc.h:705
TIME'10:10:10'.
Definition: item_timefunc.h:889
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:910
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:918
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:919
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.h:923
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:971
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:920
Item_time_literal(MYSQL_TIME *ltime, uint dec_arg)
Constructor for Item_time_literal.
Definition: item_timefunc.h:898
const char * func_name() const override
Definition: item_timefunc.h:903
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:976
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.h:906
table_map used_tables() const override
Definition: item_timefunc.h:921
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:922
String * val_str(String *str) override
Definition: item_timefunc.h:914
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:890
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:1662
String * val_str(String *str) override
Definition: item_timefunc.cc:1682
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:1667
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:1675
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:397
Definition: item_timefunc.h:1435
bool m_explicit_cast
Definition: item_timefunc.h:1436
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1447
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:2967
const char * cast_type() const
Definition: item_timefunc.h:1458
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2976
const char * func_name() const override
Definition: item_timefunc.h:1454
bool is_explicit_cast() const
Definition: item_timefunc.h:1456
enum Functype functype() const override
Definition: item_timefunc.h:1455
Item_typecast_date(Item *a, bool explicit_cast)
Definition: item_timefunc.h:1439
Item_typecast_date(const POS &pos, Item *a)
Definition: item_timefunc.h:1443
Definition: item_timefunc.h:1499
Item_typecast_datetime(Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1516
Item_typecast_datetime(const POS &pos, Item *a)
Definition: item_timefunc.h:1508
Item_typecast_datetime(Item *a, bool explicit_cast)
Definition: item_timefunc.h:1504
enum Functype functype() const override
Definition: item_timefunc.h:1523
bool is_explicit_cast() const
Definition: item_timefunc.h:1525
const char * func_name() const override
Definition: item_timefunc.h:1522
bool m_explicit_cast
Definition: item_timefunc.h:1501
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1526
Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1511
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:2907
bool detect_precision_from_arg
Definition: item_timefunc.h:1500
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2917
const char * cast_type() const
Definition: item_timefunc.h:1524
Definition: item_timefunc.h:1461
Item_typecast_time(Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1477
Item_typecast_time(const POS &pos, Item *a)
Definition: item_timefunc.h:1469
bool is_explicit_cast() const
Definition: item_timefunc.h:1485
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1488
Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1472
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2955
const char * cast_type() const
Definition: item_timefunc.h:1487
enum Functype functype() const override
Definition: item_timefunc.h:1484
bool detect_precision_from_arg
Definition: item_timefunc.h:1462
Item_typecast_time(Item *a)
Definition: item_timefunc.h:1466
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:2945
const char * func_name() const override
Definition: item_timefunc.h:1483
bool m_explicit_cast
Definition: item_timefunc.h:1463
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:1530
Item_typecast_year(const POS &pos, Item *a)
Definition: item_timefunc.h:300
longlong val_int() override
Definition: item_timefunc.cc:1546
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:1539
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:930
void set_nullable(bool nullable)
Definition: item.h:3670
void set_data_type_date()
Set all type properties for Item of DATE type.
Definition: item.h:1696
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3568
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:1513
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:1739
static const CHARSET_INFO * default_charset()
Definition: item.cc:1851
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:1689
bool get_time_from_datetime(MYSQL_TIME *ltime)
Convert datetime to time.
Definition: item.cc:1784
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:1771
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:1776
enum_field_types data_type() const
Retrieve the derived data type of the Item.
Definition: item.h:1481
bool fixed
True if item has been resolved.
Definition: item.h:3658
longlong val_int_from_time()
Definition: item.cc:486
bool null_value
True if item is null.
Definition: item.h:3695
void set_data_type_datetime(uint8 fsp)
Set all properties for Item of DATETIME type.
Definition: item.h:1720
virtual uint datetime_precision()
DATETIME precision of the item: 0..6.
Definition: item.cc:829
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1699
my_decimal * val_decimal_from_date(my_decimal *decimal_value)
Definition: item.cc:384
@ MARKER_NONE
Definition: item.h:3588
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1652
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:3627
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1791
uint8 decimals
Number of decimals in result when evaluating this item.
Definition: item.h:3667
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1600
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1680
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:1555
void set_data_type_time(uint8 fsp)
Set all type properties for Item of TIME type.
Definition: item.h:1708
void set_data_type_decimal(uint8 precision, uint8 scale)
Set the data type of the Item to be decimal.
Definition: item.h:1569
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:1767
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:747
uint string_length
length of string
Definition: item_timefunc.h:751
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:1984
void set_time(MYSQL_TIME *ltime, uint8 dec_arg)
Set time and time_packed from a TIME value.
Definition: item_timefunc.cc:1928
MYSQL_TIME * get_TIME_ptr()
Return pointer to MYSQL_TIME representation.
Definition: item_timefunc.h:832
bool get_time(MYSQL_TIME *ltime) const
Store MYSQL_TIME representation into the given time variable.
Definition: item_timefunc.h:825
longlong val_packed() const
Return packed representation.
Definition: item_timefunc.h:813
MYSQL_TIME_cache()
Definition: item_timefunc.h:763
uint8 decimals() const
Return number of decimal digits.
Definition: item_timefunc.h:805
uint8 dec
Number of decimals.
Definition: item_timefunc.h:752
const char * cptr() const
Return C string representation.
Definition: item_timefunc.h:843
longlong time_packed
packed representation
Definition: item_timefunc.h:749
void set_date(MYSQL_TIME *ltime)
Set time and time_packed from a DATE value.
Definition: item_timefunc.cc:1936
MYSQL_TIME time
MYSQL_TIME representation.
Definition: item_timefunc.h:748
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:1944
bool eq(const MYSQL_TIME_cache &tm) const
Test if cached value is equal to another MYSQL_TIME_cache value.
Definition: item_timefunc.h:798
String * val_str(String *str)
Store string representation into String.
Definition: item_timefunc.cc:1991
char string_buff[MAX_DATE_STRING_REP_LENGTH]
string representation
Definition: item_timefunc.h:750
void get_TIME(MYSQL_TIME *ltime) const
Store MYSQL_TIME representation into the given MYSQL_TIME variable.
Definition: item_timefunc.h:757
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:204
@ VGS_CHECK_CONSTRAINT
Definition: field.h:478
@ VGS_GENERATED_COLUMN
Definition: field.h:476
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:89
@ MYSQL_TYPE_NEWDECIMAL
Definition: field_types.h:81
@ 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:2683
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:522
date_time_format
Definition: item_timefunc.h:1665
@ USA_FORMAT
Definition: item_timefunc.h:1666
@ JIS_FORMAT
Definition: item_timefunc.h:1667
@ INTERNAL_FORMAT
Definition: item_timefunc.h:1670
@ EUR_FORMAT
Definition: item_timefunc.h:1669
@ ISO_FORMAT
Definition: item_timefunc.h:1668
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:1753
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:500
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:1081
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:2879
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:421
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:488
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:502
Value_generator_source source
Definition: item.h:500
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:1407
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