MySQL 9.1.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 void print(const THD *thd, String *str,
1001 enum_query_type query_type) const override;
1002
1003 bool set_time_zone(THD *thd);
1004
1005 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1006
1007 const char *specifier_string() const { return m_specifier_string; }
1008
1009 protected:
1010 bool check_type() const;
1011
1012 private:
1013 /// The time zone that the specifier string argument resolves to.
1014 const Time_zone *m_tz{nullptr};
1015
1016 /// The specifier string argument, not used after resolution.
1018
1019 /**
1020 Whether the syntax used the `INTERVAL` construction. We have no interval
1021 type.
1022 */
1024};
1025
1026/// Abstract CURTIME function. Children should define what time zone is used.
1029
1030 protected:
1031 // Abstract method that defines which time zone is used for conversion.
1032 virtual Time_zone *time_zone() = 0;
1033
1034 void add_json_info(Json_object *obj) override {
1035 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
1036 }
1037
1038 public:
1039 /**
1040 Constructor for Item_func_curtime.
1041 @param pos Position of token in the parser.
1042 @param dec_arg Number of fractional digits.
1043 */
1044 Item_func_curtime(const POS &pos, uint8 dec_arg) : Item_time_func(pos) {
1045 decimals = dec_arg;
1046 }
1047
1048 bool do_itemize(Parse_context *pc, Item **res) override;
1049
1050 /// This function must assign a new value for each execution
1052 return INNER_TABLE_BIT;
1053 }
1054
1055 bool resolve_type(THD *thd) override;
1056 longlong val_time_temporal() override;
1057 bool get_time(MYSQL_TIME *ltime) override;
1058 String *val_str(String *) override;
1059 bool check_function_as_value_generator(uchar *checker_args) override {
1061 pointer_cast<Check_function_as_value_generator_parameters *>(
1062 checker_args);
1063 func_arg->banned_function_name = func_name();
1064 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1065 (func_arg->source == VGS_CHECK_CONSTRAINT));
1066 }
1067};
1068
1070 protected:
1071 Time_zone *time_zone() override;
1072
1073 public:
1074 Item_func_curtime_local(const POS &pos, uint8 dec_arg)
1075 : Item_func_curtime(pos, dec_arg) {}
1076 const char *func_name() const override { return "curtime"; }
1077};
1078
1080 protected:
1081 Time_zone *time_zone() override;
1082
1083 public:
1084 Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
1085 : Item_func_curtime(pos, dec_arg) {}
1086 const char *func_name() const override { return "utc_time"; }
1087};
1088
1089/**
1090 Abstract CURDATE function.
1091
1092 @sa Item_func_curtime
1093 */
1096
1097 protected:
1098 virtual Time_zone *time_zone() = 0;
1099
1100 public:
1101 explicit Item_func_curdate(const POS &pos) : Item_date_func(pos) {}
1102
1103 bool do_itemize(Parse_context *pc, Item **res) override;
1104
1105 /// This function must assign a new value for each execution
1107 return INNER_TABLE_BIT;
1108 }
1109
1110 bool resolve_type(THD *) override;
1111 longlong val_date_temporal() override;
1112 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1113 String *val_str(String *) override;
1114 bool check_function_as_value_generator(uchar *checker_args) override {
1116 pointer_cast<Check_function_as_value_generator_parameters *>(
1117 checker_args);
1118 func_arg->banned_function_name = func_name();
1119 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1120 (func_arg->source == VGS_CHECK_CONSTRAINT));
1121 }
1122};
1123
1125 protected:
1126 Time_zone *time_zone() override;
1127
1128 public:
1129 explicit Item_func_curdate_local(const POS &pos) : Item_func_curdate(pos) {}
1130 const char *func_name() const override { return "curdate"; }
1131};
1132
1134 protected:
1135 Time_zone *time_zone() override;
1136
1137 public:
1139 const char *func_name() const override { return "utc_date"; }
1140};
1141
1142/**
1143 Abstract CURRENT_TIMESTAMP function.
1144
1145 @sa Item_func_curtime
1146*/
1148 protected:
1149 virtual Time_zone *time_zone() = 0;
1151 bool no_conversions) override;
1152
1153 void add_json_info(Json_object *obj) override {
1154 if (decimals > 0)
1155 obj->add_alias("precision", create_dom_ptr<Json_uint>(decimals));
1156 }
1157
1158 public:
1159 /**
1160 Constructor for Item_func_now.
1161 @param dec_arg Number of fractional digits.
1162 */
1164 Item_func_now(const POS &pos, uint8 dec_arg) : Item_datetime_func(pos) {
1165 decimals = dec_arg;
1166 }
1167
1168 /// This function must assign a new value for each execution
1170 return INNER_TABLE_BIT;
1171 }
1172
1173 bool resolve_type(THD *) override;
1174 longlong val_date_temporal() override;
1175 bool get_date(MYSQL_TIME *res, my_time_flags_t) override;
1176 String *val_str(String *) override;
1177 bool check_function_as_value_generator(uchar *checker_args) override {
1179 pointer_cast<Check_function_as_value_generator_parameters *>(
1180 checker_args);
1181 func_arg->banned_function_name = func_name();
1182 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1183 (func_arg->source == VGS_CHECK_CONSTRAINT));
1184 }
1185};
1186
1188 protected:
1189 Time_zone *time_zone() override;
1190
1191 public:
1192 /**
1193 Stores the query start time in a field, truncating to the field's number
1194 of fractional second digits.
1195
1196 @param field The field to store in.
1197 */
1198 static void store_in(Field *field);
1199
1201 Item_func_now_local(const POS &pos, uint8 dec_arg)
1202 : Item_func_now(pos, dec_arg) {}
1203
1204 const char *func_name() const override { return "now"; }
1205 enum Functype functype() const override { return NOW_FUNC; }
1206};
1207
1208class Item_func_now_utc final : public Item_func_now {
1210
1211 protected:
1212 Time_zone *time_zone() override;
1213
1214 public:
1215 Item_func_now_utc(const POS &pos, uint8 dec_arg)
1216 : Item_func_now(pos, dec_arg) {}
1217
1218 bool do_itemize(Parse_context *pc, Item **res) override;
1219
1220 const char *func_name() const override { return "utc_timestamp"; }
1221};
1222
1223/**
1224 SYSDATE() is like NOW(), but always uses the real current time, not the
1225 query_start(). This matches the Oracle behavior.
1226*/
1228 public:
1230 decimals = dec_arg;
1231 }
1232 const char *func_name() const override { return "sysdate"; }
1233 bool resolve_type(THD *) override;
1234 enum Functype functype() const override { return SYSDATE_FUNC; }
1235 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1236 /**
1237 This function is non-deterministic and hence depends on the 'RAND'
1238 pseudo-table.
1239
1240 @retval Always RAND_TABLE_BIT
1241 */
1243 return RAND_TABLE_BIT;
1244 }
1245};
1246
1248 public:
1249 Item_func_from_days(const POS &pos, Item *a) : Item_date_func(pos, a) {}
1250 const char *func_name() const override { return "from_days"; }
1251 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1252 bool check_partition_func_processor(uchar *) override { return false; }
1253 enum Functype functype() const override { return FROM_DAYS_FUNC; }
1255 return has_date_args() || has_time_args();
1256 }
1257 bool resolve_type(THD *thd) override {
1258 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
1259 if (reject_vector_args()) return true;
1260 return Item_date_func::resolve_type(thd);
1261 }
1262};
1263
1266 const bool is_time_format;
1268
1269 public:
1271 bool is_time_format_arg = false)
1272 : Item_str_func(pos, a, b), is_time_format(is_time_format_arg) {}
1273 String *val_str(String *str) override;
1274 const char *func_name() const override {
1275 return is_time_format ? "time_format" : "date_format";
1276 }
1277 bool resolve_type(THD *thd) override;
1278 uint format_length(const String *format);
1279 bool eq_specific(const Item *item) const override;
1280};
1281
1283 public:
1285 : Item_datetime_func(pos, a) {}
1286 const char *func_name() const override { return "from_unixtime"; }
1287 enum Functype functype() const override { return FROM_UNIXTIME_FUNC; }
1288 bool resolve_type(THD *thd) override;
1289 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1290};
1291
1292/*
1293 This class represents CONVERT_TZ() function.
1294 The important fact about this function that it is handled in special way.
1295 When such function is met in expression time_zone system tables are added
1296 to global list of tables to open, so later those already opened and locked
1297 tables can be used during this function calculation for loading time zone
1298 descriptions.
1299*/
1301 /*
1302 If time zone parameters are constants we are caching objects that
1303 represent them (we use separate from_tz_cached/to_tz_cached members
1304 to indicate this fact, since NULL is legal value for from_tz/to_tz
1305 members.
1306 */
1309
1310 public:
1311 Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
1312 : Item_datetime_func(pos, a, b, c),
1313 from_tz_cached(false),
1314 to_tz_cached(false) {}
1315 const char *func_name() const override { return "convert_tz"; }
1316 enum Functype functype() const override { return CONVERT_TZ_FUNC; }
1317 bool resolve_type(THD *) override;
1318 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1319 void cleanup() override;
1320};
1321
1323 public:
1324 Item_func_sec_to_time(const POS &pos, Item *item)
1325 : Item_time_func(pos, item) {}
1326 bool resolve_type(THD *thd) override {
1327 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_NEWDECIMAL)) return true;
1328 if (reject_vector_args()) return true;
1330 std::min(args[0]->decimals, uint8{DATETIME_MAX_DECIMALS}));
1331 set_nullable(true);
1332 return false;
1333 }
1334 const char *func_name() const override { return "sec_to_time"; }
1335 enum Functype functype() const override { return SEC_TO_TIME_FUNC; }
1336 bool get_time(MYSQL_TIME *ltime) override;
1337};
1338
1339extern const char *interval_names[];
1340
1341/**
1342 Implementation class for the DATE_ADD and DATE_SUB functions.
1343 Also used for the synonym functions ADDDATE and SUBDATE.
1344*/
1347
1348 public:
1350 bool subtract)
1351 : Item_temporal_hybrid_func(pos, a, b),
1353 m_subtract(subtract) {}
1354 /**
1355 POS-less ctor for post-parse construction with implicit addition to THD's
1356 free_list (see Item::Item() no-argument ctor).
1357 */
1361 m_subtract(subtract) {}
1362 const char *func_name() const override { return "date_add_interval"; }
1363 enum Functype functype() const override { return DATEADD_FUNC; }
1364 bool resolve_type(THD *) override;
1365 bool eq_specific(const Item *item) const override;
1366 void print(const THD *thd, String *str,
1367 enum_query_type query_type) const override;
1369 bool is_subtract() const { return m_subtract; }
1370
1371 protected:
1372 void add_json_info(Json_object *obj) override;
1373
1374 private:
1375 bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1376 bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date);
1377 bool get_time_internal(MYSQL_TIME *res);
1378
1379 /// The type of the interval argument
1381 /// False if function is DATE_ADD, true if function is DATE_SUB
1382 const bool m_subtract;
1384};
1385
1386class Item_extract final : public Item_int_func {
1388
1389 public:
1390 const interval_type int_type; // keep it public
1391 Item_extract(const POS &pos, interval_type type_arg, Item *a)
1392 : Item_int_func(pos, a), int_type(type_arg) {}
1393 longlong val_int() override;
1394 enum Functype functype() const override { return EXTRACT_FUNC; }
1395 const char *func_name() const override { return "extract"; }
1396 bool resolve_type(THD *) override;
1397 bool eq_specific(const Item *item) const override;
1398 void print(const THD *thd, String *str,
1399 enum_query_type query_type) const override;
1400 bool check_partition_func_processor(uchar *) override { return false; }
1402 switch (int_type) {
1403 case INTERVAL_YEAR:
1405 case INTERVAL_QUARTER:
1406 case INTERVAL_MONTH:
1407 /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
1408 case INTERVAL_DAY:
1409 return !has_date_args();
1410 case INTERVAL_DAY_HOUR:
1414 return !has_datetime_args();
1415 case INTERVAL_HOUR:
1418 case INTERVAL_MINUTE:
1420 case INTERVAL_SECOND:
1425 return !has_time_args();
1426 default:
1427 /*
1428 INTERVAL_LAST is only an end marker,
1429 INTERVAL_WEEK depends on default_week_format which is a session
1430 variable and cannot be used for partitioning. See bug#57071.
1431 */
1432 break;
1433 }
1434 return true;
1435 }
1436};
1437
1440
1441 public:
1442 Item_typecast_date(Item *a, bool explicit_cast)
1443 : Item_date_func(a), m_explicit_cast(explicit_cast) {
1444 set_nullable(true);
1445 }
1446 Item_typecast_date(const POS &pos, Item *a) : Item_date_func(pos, a) {
1447 set_nullable(true);
1448 }
1449
1450 bool resolve_type(THD *thd) override {
1451 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATE, false, true)) return true;
1452 if (reject_vector_args()) return true;
1453 return Item_date_func::resolve_type(thd);
1454 }
1455 void print(const THD *thd, String *str,
1456 enum_query_type query_type) const override;
1457 const char *func_name() const override { return "cast_as_date"; }
1458 enum Functype functype() const override { return TYPECAST_FUNC; }
1459 bool is_explicit_cast() const { return m_explicit_cast; }
1460 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1461 const char *cast_type() const { return "date"; }
1462};
1463
1467
1468 public:
1471 }
1472 Item_typecast_time(const POS &pos, Item *a) : Item_time_func(pos, a) {
1474 }
1475 Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
1476 : Item_time_func(pos, a) {
1478 decimals = dec_arg;
1479 }
1482 decimals = dec_arg;
1483 }
1484 void print(const THD *thd, String *str,
1485 enum_query_type query_type) const override;
1486 const char *func_name() const override { return "cast_as_time"; }
1487 enum Functype functype() const override { return TYPECAST_FUNC; }
1488 bool is_explicit_cast() const { return m_explicit_cast; }
1489 bool get_time(MYSQL_TIME *ltime) override;
1490 const char *cast_type() const { return "time"; }
1491 bool resolve_type(THD *thd) override {
1492 if (reject_vector_args()) return true;
1493 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATETIME, false, true))
1494 return true;
1496 : decimals);
1497 set_nullable(true);
1498 return false;
1499 }
1500};
1501
1505
1506 public:
1507 Item_typecast_datetime(Item *a, bool explicit_cast)
1508 : Item_datetime_func(a), m_explicit_cast(explicit_cast) {
1510 }
1513 }
1514 Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
1515 : Item_datetime_func(pos, a) {
1517 decimals = dec_arg;
1518 }
1521 decimals = dec_arg;
1522 }
1523 void print(const THD *thd, String *str,
1524 enum_query_type query_type) const override;
1525 const char *func_name() const override { return "cast_as_datetime"; }
1526 enum Functype functype() const override { return TYPECAST_FUNC; }
1527 const char *cast_type() const { return "datetime"; }
1528 bool is_explicit_cast() const { return m_explicit_cast; }
1529 bool resolve_type(THD *thd) override {
1530 if (reject_vector_args()) return true;
1531 if (args[0]->propagate_type(thd, MYSQL_TYPE_DATETIME, false, true))
1532 return true;
1535 set_nullable(true);
1536 return false;
1537 }
1538 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1539};
1540
1542 public:
1543 Item_func_makedate(const POS &pos, Item *a, Item *b)
1544 : Item_date_func(pos, a, b) {
1545 set_nullable(true);
1546 }
1547 const char *func_name() const override { return "makedate"; }
1548 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1549 enum Functype functype() const override { return MAKEDATE_FUNC; }
1550 bool resolve_type(THD *thd) override {
1551 if (reject_vector_args()) return true;
1552 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_LONGLONG)) return true;
1553 return Item_date_func::resolve_type(thd);
1554 }
1555};
1556
1557/**
1558 Add a time expression to a temporal expression, or
1559 subtract a time expression from a temporal expression.
1560 Used to implement the functions ADDTIME and SUBTIME, and the
1561 two-argument version of TIMESTAMP (which sets m_datetime = true).
1562*/
1564 const bool m_datetime; ///< True if first argument expected to be datetime
1565 int m_sign; ///< +1 for ADD, -1 for SUBTRACT
1566
1567 bool val_datetime(MYSQL_TIME *time, my_time_flags_t fuzzy_date) override;
1568
1569 public:
1570 Item_func_add_time(Item *a, Item *b, bool datetime, bool negate)
1572 m_datetime(datetime),
1573 m_sign(negate ? -1 : 1) {}
1574 Item_func_add_time(const POS &pos, Item *a, Item *b, bool datetime,
1575 bool negate)
1576 : Item_temporal_hybrid_func(pos, a, b),
1577 m_datetime(datetime),
1578 m_sign(negate ? -1 : 1) {}
1579
1580 Item_func_add_time(const POS &pos, Item *a, Item *b)
1581 : Item_func_add_time(pos, a, b, false, false) {}
1582
1583 bool resolve_type(THD *) override;
1584 void print(const THD *thd, String *str,
1585 enum_query_type query_type) const override;
1586 const char *func_name() const override { return "add_time"; }
1587 enum Functype functype() const override { return ADDTIME_FUNC; }
1588 int sign() const { return m_sign; }
1589};
1590
1592 public:
1593 Item_func_timediff(const POS &pos, Item *a, Item *b)
1594 : Item_time_func(pos, a, b) {}
1595 const char *func_name() const override { return "timediff"; }
1596 enum Functype functype() const override { return TIMEDIFF_FUNC; }
1597 bool resolve_type(THD *thd) override {
1598 if (reject_vector_args()) return true;
1599 /*
1600 This function can operate on two TIME, or on two DATETIME (no mix).
1601 We infer the type from the other argument. If both arguments are '?', we
1602 choose VARCHAR; indeed, if we chose TIME and get DATETIME, we risk
1603 cutting the date part, and if we chose DATETIME and get TIME, we risk
1604 interpreting "01:01:01" as "2001:01:01 00:00:00".
1605 */
1606 if (param_type_uses_non_param(thd)) return true;
1608 std::max(args[0]->time_precision(), args[1]->time_precision()));
1609 set_nullable(true);
1610 return false;
1611 }
1612 bool get_time(MYSQL_TIME *ltime) override;
1613};
1614
1616 public:
1617 Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
1618 : Item_time_func(pos, a, b, c) {
1619 set_nullable(true);
1620 }
1621 bool resolve_type(THD *thd) override {
1622 if (reject_vector_args()) return true;
1623 if (param_type_is_default(thd, 0, 2, MYSQL_TYPE_LONGLONG)) return true;
1624 if (param_type_is_default(thd, 2, 3, MYSQL_TYPE_NEWDECIMAL)) return true;
1626 std::min(args[2]->decimals, uint8{DATETIME_MAX_DECIMALS}));
1627 return false;
1628 }
1629 const char *func_name() const override { return "maketime"; }
1630 enum Functype functype() const override { return MAKETIME_FUNC; }
1631 bool get_time(MYSQL_TIME *ltime) override;
1632};
1633
1635 public:
1636 Item_func_microsecond(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1637 longlong val_int() override;
1638 const char *func_name() const override { return "microsecond"; }
1639 enum Functype functype() const override { return MICROSECOND_FUNC; }
1640 bool resolve_type(THD *thd) override;
1641 bool check_partition_func_processor(uchar *) override { return false; }
1643 return !has_time_args();
1644 }
1645};
1646
1649
1650 public:
1652 interval_type type_arg)
1653 : Item_int_func(pos, a, b), int_type(type_arg) {}
1654 const char *func_name() const override { return "timestampdiff"; }
1655 enum Functype functype() const override { return TIMESTAMPDIFF_FUNC; }
1657 longlong val_int() override;
1658 bool resolve_type(THD *thd) override {
1659 if (reject_vector_args()) return true;
1660 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_DATETIME)) return true;
1661 set_nullable(true);
1662 return false;
1663 }
1664 void print(const THD *thd, String *str,
1665 enum_query_type query_type) const override;
1666};
1667
1675
1677 public:
1678 const enum_mysql_timestamp_type type; // keep it public
1680 Item *a)
1681 : Item_str_ascii_func(pos, a), type(type_arg) {}
1682 String *val_str_ascii(String *str) override;
1683 const char *func_name() const override { return "get_format"; }
1684 enum Functype functype() const override { return GET_FORMAT_FUNC; }
1685 bool resolve_type(THD *thd) override {
1686 if (reject_vector_args()) return true;
1687 if (param_type_is_default(thd, 0, -1)) return true;
1688 set_nullable(true);
1690 return false;
1691 }
1692 void print(const THD *thd, String *str,
1693 enum_query_type query_type) const override;
1694
1696};
1697
1700 void fix_from_format(const char *format, size_t length);
1701
1702 protected:
1703 bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1704
1705 public:
1707 : Item_temporal_hybrid_func(pos, a, b) {}
1708 const char *func_name() const override { return "str_to_date"; }
1709 bool resolve_type(THD *) override;
1710};
1711
1713 public:
1714 Item_func_last_day(const POS &pos, Item *a) : Item_date_func(pos, a) {
1715 set_nullable(true);
1716 }
1717 const char *func_name() const override { return "last_day"; }
1718 enum Functype functype() const override { return LAST_DAY_FUNC; }
1719 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1720 bool resolve_type(THD *thd) override {
1721 if (reject_vector_args()) return true;
1722 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_DATETIME)) return true;
1723 return Item_date_func::resolve_type(thd);
1724 }
1725};
1726
1728 public:
1730 : Item_datetime_func(pos, list) {}
1731 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1732 const char *func_name() const override { return "internal_update_time"; }
1733 bool resolve_type(THD *thd) override;
1734 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1735};
1736
1738 public:
1740 : Item_datetime_func(pos, list) {}
1741 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1742 const char *func_name() const override { return "internal_check_time"; }
1743 bool resolve_type(THD *thd) override;
1744 bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1745};
1746
1747/* Function prototypes */
1748
1749bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time,
1751
1752#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:1345
enum Functype functype() const override
Definition: item_timefunc.h:1363
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2709
const bool m_subtract
False if function is DATE_ADD, true if function is DATE_SUB.
Definition: item_timefunc.h:1382
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:2676
Item_temporal_hybrid_func super
Definition: item_timefunc.h:1346
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:2669
const char * func_name() const override
Definition: item_timefunc.h:1362
bool is_subtract() const
Definition: item_timefunc.h:1369
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.cc:2720
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2489
bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date)
Definition: item_timefunc.cc:2581
const interval_type m_interval_type
The type of the interval argument.
Definition: item_timefunc.h:1380
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:1358
interval_type get_interval_type() const
Definition: item_timefunc.h:1368
String value
Definition: item_timefunc.h:1383
bool get_time_internal(MYSQL_TIME *res)
Definition: item_timefunc.cc:2616
Item_date_add_interval(const POS &pos, Item *a, Item *b, interval_type type, bool subtract)
Definition: item_timefunc.h:1349
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:931
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:952
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:947
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:939
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:963
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:958
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:1386
bool date_value
Definition: item_timefunc.h:1387
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1401
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2727
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:2906
const char * func_name() const override
Definition: item_timefunc.h:1395
enum Functype functype() const override
Definition: item_timefunc.h:1394
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2736
longlong val_int() override
Definition: item_timefunc.cc:2828
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1400
const interval_type int_type
Definition: item_timefunc.h:1390
Item_extract(const POS &pos, interval_type type_arg, Item *a)
Definition: item_timefunc.h:1391
Add a time expression to a temporal expression, or subtract a time expression from a temporal express...
Definition: item_timefunc.h:1563
int m_sign
+1 for ADD, -1 for SUBTRACT
Definition: item_timefunc.h:1565
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3047
const char * func_name() const override
Definition: item_timefunc.h:1586
Item_func_add_time(Item *a, Item *b, bool datetime, bool negate)
Definition: item_timefunc.h:1570
const bool m_datetime
True if first argument expected to be datetime.
Definition: item_timefunc.h:1564
int sign() const
Definition: item_timefunc.h:1588
enum Functype functype() const override
Definition: item_timefunc.h:1587
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:3092
Item_func_add_time(const POS &pos, Item *a, Item *b, bool datetime, bool negate)
Definition: item_timefunc.h:1574
Item_func_add_time(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1580
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3161
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:1035
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:981
bool set_time_zone(THD *thd)
Definition: item_timefunc.cc:999
const char * func_name() const override
Definition: item_timefunc.h:998
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:993
bool m_is_interval
Whether the syntax used the INTERVAL construction.
Definition: item_timefunc.h:1023
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:1010
const char * m_specifier_string
The specifier string argument, not used after resolution.
Definition: item_timefunc.h:1017
const Time_zone * m_tz
The time zone that the specifier string argument resolves to.
Definition: item_timefunc.h:1014
const char * specifier_string() const
Definition: item_timefunc.h:1007
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:1300
const char * func_name() const override
Definition: item_timefunc.h:1315
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2445
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2436
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_timefunc.cc:2483
Time_zone * from_tz
Definition: item_timefunc.h:1308
Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1311
bool from_tz_cached
Definition: item_timefunc.h:1307
bool to_tz_cached
Definition: item_timefunc.h:1307
enum Functype functype() const override
Definition: item_timefunc.h:1316
Time_zone * to_tz
Definition: item_timefunc.h:1308
Definition: item_timefunc.h:1124
Time_zone * time_zone() override
Definition: item_timefunc.cc:2015
const char * func_name() const override
Definition: item_timefunc.h:1130
Item_func_curdate_local(const POS &pos)
Definition: item_timefunc.h:1129
Definition: item_timefunc.h:1133
Time_zone * time_zone() override
Definition: item_timefunc.cc:2019
Item_func_curdate_utc(const POS &pos)
Definition: item_timefunc.h:1138
const char * func_name() const override
Definition: item_timefunc.h:1139
Abstract CURDATE function.
Definition: item_timefunc.h:1094
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2010
Item_date_func super
Definition: item_timefunc.h:1095
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:2021
String * val_str(String *) override
Definition: item_timefunc.cc:2035
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:1114
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:2028
Item_func_curdate(const POS &pos)
Definition: item_timefunc.h:1101
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2003
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1106
Definition: item_timefunc.h:1069
Item_func_curtime_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1074
const char * func_name() const override
Definition: item_timefunc.h:1076
Time_zone * time_zone() override
Definition: item_timefunc.cc:2100
Definition: item_timefunc.h:1079
Time_zone * time_zone() override
Definition: item_timefunc.cc:2104
const char * func_name() const override
Definition: item_timefunc.h:1086
Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1084
Abstract CURTIME function. Children should define what time zone is used.
Definition: item_timefunc.h:1027
virtual Time_zone * time_zone()=0
String * val_str(String *) override
Definition: item_timefunc.cc:2087
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1051
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2056
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2079
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:1059
Item_func_curtime(const POS &pos, uint8 dec_arg)
Constructor for Item_func_curtime.
Definition: item_timefunc.h:1044
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2049
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:1034
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.cc:2071
Item_time_func super
Definition: item_timefunc.h:1028
Definition: item_timefunc.h:1264
const bool is_time_format
Definition: item_timefunc.h:1266
int fixed_length
Definition: item_timefunc.h:1265
const char * func_name() const override
Definition: item_timefunc.h:1274
String * val_str(String *str) override
Definition: item_timefunc.cc:2332
Item_func_date_format(const POS &pos, Item *a, Item *b, bool is_time_format_arg=false)
Definition: item_timefunc.h:1270
String value
Definition: item_timefunc.h:1267
uint format_length(const String *format)
Definition: item_timefunc.cc:2262
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2214
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_timefunc.cc:2243
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:1495
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:1507
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:1252
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:1263
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:1233
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:197
longlong val_int() override
Definition: item_timefunc.cc:1244
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:1247
const char * func_name() const override
Definition: item_timefunc.h:1250
Item_func_from_days(const POS &pos, Item *a)
Definition: item_timefunc.h:1249
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1254
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1257
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1252
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:1909
enum Functype functype() const override
Definition: item_timefunc.h:1253
Definition: item_timefunc.h:1282
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2383
const char * func_name() const override
Definition: item_timefunc.h:1286
Item_func_from_unixtime(const POS &pos, Item *a)
Definition: item_timefunc.h:1284
enum Functype functype() const override
Definition: item_timefunc.h:1287
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2374
Definition: item_timefunc.h:1676
String * val_str_ascii(String *str) override
Definition: item_timefunc.cc:3471
const char * func_name() const override
Definition: item_timefunc.h:1683
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3498
enum Functype functype() const override
Definition: item_timefunc.h:1684
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1685
enum_mysql_timestamp_type timestamp_type() const
Definition: item_timefunc.h:1695
Item_func_get_format(const POS &pos, enum_mysql_timestamp_type type_arg, Item *a)
Definition: item_timefunc.h:1679
const enum_mysql_timestamp_type type
Definition: item_timefunc.h:1678
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:1334
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:210
longlong val_int() override
Definition: item_timefunc.cc:1344
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:1737
enum Functype functype() const override
Definition: item_timefunc.h:1741
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3780
const char * func_name() const override
Definition: item_timefunc.h:1742
Item_func_internal_check_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1739
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3772
Definition: item_timefunc.h:1727
const char * func_name() const override
Definition: item_timefunc.h:1732
enum Functype functype() const override
Definition: item_timefunc.h:1731
Item_func_internal_update_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1729
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3693
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3701
Definition: item_timefunc.h:1712
Item_func_last_day(const POS &pos, Item *a)
Definition: item_timefunc.h:1714
const char * func_name() const override
Definition: item_timefunc.h:1717
enum Functype functype() const override
Definition: item_timefunc.h:1718
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1720
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3669
Definition: item_timefunc.h:1541
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1550
enum Functype functype() const override
Definition: item_timefunc.h:1549
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:3018
Item_func_makedate(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1543
const char * func_name() const override
Definition: item_timefunc.h:1547
Definition: item_timefunc.h:1615
enum Functype functype() const override
Definition: item_timefunc.h:1630
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1621
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:3245
Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1617
const char * func_name() const override
Definition: item_timefunc.h:1629
Definition: item_timefunc.h:1634
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1642
longlong val_int() override
MICROSECOND(a) is a function ( extraction) that extracts the microseconds from a.
Definition: item_timefunc.cc:3318
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3324
enum Functype functype() const override
Definition: item_timefunc.h:1639
Item_func_microsecond(const POS &pos, Item *a)
Definition: item_timefunc.h:1636
const char * func_name() const override
Definition: item_timefunc.h:1638
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1641
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:1350
const char * func_name() const override
Definition: item_timefunc.h:219
longlong val_int() override
Definition: item_timefunc.cc:1360
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:1269
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:1280
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:1298
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:1286
Definition: item_timefunc.h:1187
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:2116
Time_zone * time_zone() override
Definition: item_timefunc.cc:2123
const char * func_name() const override
Definition: item_timefunc.h:1204
Item_func_now_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1201
enum Functype functype() const override
Definition: item_timefunc.h:1205
Item_func_now_local(uint8 dec_arg)
Definition: item_timefunc.h:1200
Definition: item_timefunc.h:1208
const char * func_name() const override
Definition: item_timefunc.h:1220
Item_func_now_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1215
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:2125
Item_func_now super
Definition: item_timefunc.h:1209
Time_zone * time_zone() override
Definition: item_timefunc.cc:2132
Abstract CURRENT_TIMESTAMP function.
Definition: item_timefunc.h:1147
Item_func_now(uint8 dec_arg)
Constructor for Item_func_now.
Definition: item_timefunc.h:1163
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:2163
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:2134
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2108
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:1177
String * val_str(String *) override
Definition: item_timefunc.cc:2150
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_timefunc.h:1153
table_map get_initial_pseudo_tables() const override
This function must assign a new value for each execution.
Definition: item_timefunc.h:1169
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.cc:2142
Item_func_now(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1164
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:1049
longlong val_int() override
Definition: item_timefunc.cc:1054
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:1068
longlong val_int() override
Definition: item_timefunc.cc:1073
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:1327
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1313
Definition: item_timefunc.h:1322
const char * func_name() const override
Definition: item_timefunc.h:1334
Item_func_sec_to_time(const POS &pos, Item *item)
Definition: item_timefunc.h:1324
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1326
enum Functype functype() const override
Definition: item_timefunc.h:1335
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2195
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:1366
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:1379
Definition: item_timefunc.h:1698
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:3585
Item_func_str_to_date(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1706
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:3619
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:3535
const char * func_name() const override
Definition: item_timefunc.h:1708
enum_mysql_timestamp_type cached_timestamp_type
Definition: item_timefunc.h:1699
SYSDATE() is like NOW(), but always uses the real current time, not the query_start().
Definition: item_timefunc.h:1227
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:1242
const char * func_name() const override
Definition: item_timefunc.h:1232
Item_func_sysdate_local(uint8 dec_arg)
Definition: item_timefunc.h:1229
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:2189
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:2176
enum Functype functype() const override
Definition: item_timefunc.h:1234
Definition: item_timefunc.h:464
enum Functype functype() const override
Definition: item_timefunc.h:470
longlong val_int() override
Definition: item_timefunc.cc:1743
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:1735
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:1591
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:3189
enum Functype functype() const override
Definition: item_timefunc.h:1596
Item_func_timediff(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1593
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1597
const char * func_name() const override
Definition: item_timefunc.h:1595
Definition: item_timefunc.h:1647
interval_type intervaltype() const
Definition: item_timefunc.h:1656
const char * func_name() const override
Definition: item_timefunc.h:1654
enum Functype functype() const override
Definition: item_timefunc.h:1655
longlong val_int() override
Definition: item_timefunc.cc:3331
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:3427
Item_func_timestamp_diff(const POS &pos, Item *a, Item *b, interval_type type_arg)
Definition: item_timefunc.h:1651
const interval_type int_type
Definition: item_timefunc.h:1648
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1658
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:1088
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:95
longlong val_int() override
Definition: item_timefunc.cc:1102
enum Functype functype() const override
Definition: item_timefunc.h:91
const char * func_name() const override
Definition: item_timefunc.h:90
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:96
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1184
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1165
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:1175
Item_func_to_seconds(const POS &pos, Item *a)
Definition: item_timefunc.h:103
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.cc:1132
longlong val_int() override
Definition: item_timefunc.cc:1139
enum Functype functype() const override
Definition: item_timefunc.h:106
const char * func_name() const override
Definition: item_timefunc.h:105
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:110
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1109
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:121
Definition: item_timefunc.h:405
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:422
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_timefunc.h:432
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1726
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:1719
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1696
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:1707
Definition: item_timefunc.h:254
const char * func_name() const override
Definition: item_timefunc.h:264
longlong val_int() override
Definition: item_timefunc.cc:1445
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_timefunc.cc:1391
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:1402
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:1474
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:1484
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:1640
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1632
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:1529
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:1521
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:1453
enum Functype functype() const override
Definition: item_timefunc.h:275
longlong val_int() override
Definition: item_timefunc.cc:1464
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:1596
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:661
enum Type type() const override
Definition: item_func.h:365
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:671
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:130
bool has_time_args()
Definition: item_func.h:682
bool has_datetime_args()
Definition: item_func.h:693
Definition: item_func.h:1020
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:806
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:826
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:855
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:890
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:901
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:848
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.cc:876
Abstract class for functions returning TIME values.
Definition: item_timefunc.h: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:925
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:970
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:975
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:1667
String * val_str(String *str) override
Definition: item_timefunc.cc:1687
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:1672
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:1680
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:397
Definition: item_timefunc.h:1438
bool m_explicit_cast
Definition: item_timefunc.h:1439
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1450
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:2972
const char * cast_type() const
Definition: item_timefunc.h:1461
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2981
const char * func_name() const override
Definition: item_timefunc.h:1457
bool is_explicit_cast() const
Definition: item_timefunc.h:1459
enum Functype functype() const override
Definition: item_timefunc.h:1458
Item_typecast_date(Item *a, bool explicit_cast)
Definition: item_timefunc.h:1442
Item_typecast_date(const POS &pos, Item *a)
Definition: item_timefunc.h:1446
Definition: item_timefunc.h:1502
Item_typecast_datetime(Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1519
Item_typecast_datetime(const POS &pos, Item *a)
Definition: item_timefunc.h:1511
Item_typecast_datetime(Item *a, bool explicit_cast)
Definition: item_timefunc.h:1507
enum Functype functype() const override
Definition: item_timefunc.h:1526
bool is_explicit_cast() const
Definition: item_timefunc.h:1528
const char * func_name() const override
Definition: item_timefunc.h:1525
bool m_explicit_cast
Definition: item_timefunc.h:1504
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1529
Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1514
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:2912
bool detect_precision_from_arg
Definition: item_timefunc.h:1503
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2922
const char * cast_type() const
Definition: item_timefunc.h:1527
Definition: item_timefunc.h:1464
Item_typecast_time(Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1480
Item_typecast_time(const POS &pos, Item *a)
Definition: item_timefunc.h:1472
bool is_explicit_cast() const
Definition: item_timefunc.h:1488
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_timefunc.h:1491
Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1475
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2960
const char * cast_type() const
Definition: item_timefunc.h:1490
enum Functype functype() const override
Definition: item_timefunc.h:1487
bool detect_precision_from_arg
Definition: item_timefunc.h:1465
Item_typecast_time(Item *a)
Definition: item_timefunc.h:1469
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:2950
const char * func_name() const override
Definition: item_timefunc.h:1486
bool m_explicit_cast
Definition: item_timefunc.h:1466
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:1535
Item_typecast_year(const POS &pos, Item *a)
Definition: item_timefunc.h:300
longlong val_int() override
Definition: item_timefunc.cc:1551
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:1544
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:3687
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:3583
longlong val_int_from_decimal()
Definition: item.cc:481
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:512
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1648
static const CHARSET_INFO * default_charset()
Definition: item.cc:1760
String * val_string_from_date(String *str)
Definition: item.cc:335
double val_real_from_decimal()
Definition: item.cc:463
String * val_string_from_datetime(String *str)
Definition: item.cc:325
bool get_date_from_time(MYSQL_TIME *ltime)
Convert get_time() from time to date in MYSQL_TIME.
Definition: item.cc:1598
bool get_time_from_datetime(MYSQL_TIME *ltime)
Convert datetime to time.
Definition: item.cc:1693
longlong val_int_from_date()
Definition: item.cc:504
void set_data_type_year()
Set the data type of the Item to be YEAR.
Definition: item.h:1774
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:6516
bool get_time_from_date(MYSQL_TIME *ltime)
Convert date to time.
Definition: item.cc:1685
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:3675
longlong val_int_from_time()
Definition: item.cc:490
bool null_value
True if item is null.
Definition: item.h:3712
void set_data_type_datetime(uint8 fsp)
Set all properties for Item of DATETIME type.
Definition: item.h:1721
virtual uint datetime_precision()
DATETIME precision of the item: 0..6.
Definition: item.cc:843
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1608
my_decimal * val_decimal_from_date(my_decimal *decimal_value)
Definition: item.cc:388
@ MARKER_NONE
Definition: item.h:3604
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1561
type_conversion_status save_time_in_field(Field *field)
Definition: item.cc:535
item_marker marker
This member has several successive meanings, depending on the phase we're in (.
Definition: item.h:3644
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1700
uint8 decimals
Number of decimals in result when evaluating this item.
Definition: item.h:3684
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:1589
String * val_string_from_time(String *str)
Definition: item.cc:345
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:397
type_conversion_status save_date_in_field(Field *field)
Definition: item.cc:542
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1676
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
bool add_alias(std::string_view key, Json_dom *value)
Insert the value into the object.
Definition: json_dom.h:409
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:1989
void set_time(MYSQL_TIME *ltime, uint8 dec_arg)
Set time and time_packed from a TIME value.
Definition: item_timefunc.cc:1933
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:1941
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:1949
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:1996
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:96
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
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:2688
bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time, enum_mysql_timestamp_type type, String *str)
Create a formatted date/time value in a string.
Definition: item_timefunc.cc:521
date_time_format
Definition: item_timefunc.h:1668
@ USA_FORMAT
Definition: item_timefunc.h:1669
@ JIS_FORMAT
Definition: item_timefunc.h:1670
@ INTERNAL_FORMAT
Definition: item_timefunc.h:1673
@ EUR_FORMAT
Definition: item_timefunc.h:1672
@ ISO_FORMAT
Definition: item_timefunc.h:1671
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:1758
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:1105
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:2880
required string type
Definition: replication_group_member_actions.proto:34
"public" interface to sys_var - server configuration variables.
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
File containing constants that can be used throughout the server.
constexpr const table_map RAND_TABLE_BIT
Definition: sql_const.h:113
constexpr const table_map INNER_TABLE_BIT
Definition: sql_const.h:111
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:1421
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