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