MySQL  8.0.18
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, 2019, Oracle and/or its affiliates. All rights reserved.
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 <stddef.h>
29 #include <sys/types.h>
30 #include <algorithm>
31 
32 #include "m_ctype.h"
33 #include "my_dbug.h"
34 #include "my_inttypes.h"
35 #include "my_macros.h"
36 #include "my_table_map.h"
37 #include "my_time.h"
39 #include "mysql_time.h"
40 #include "sql/enum_query_type.h"
41 #include "sql/field.h"
42 #include "sql/item.h"
43 #include "sql/item_func.h"
44 #include "sql/item_strfunc.h" // Item_str_func
46 #include "sql/set_var.h"
47 #include "sql/sql_const.h"
48 #include "sql_string.h"
49 
50 class MY_LOCALE;
51 class PT_item_list;
52 class THD;
53 class Time_zone;
54 class my_decimal;
55 struct Date_time_format;
56 struct Interval;
57 struct TABLE;
58 
61 
63  public:
65  : Item_int_func(pos, a, b) {}
66  longlong val_int() override;
67  const char *func_name() const override { return "period_add"; }
68  bool resolve_type(THD *) override {
69  fix_char_length(6); /* YYYYMM */
70  return false;
71  }
72 };
73 
75  public:
77  : Item_int_func(pos, a, b) {}
78  longlong val_int() override;
79  const char *func_name() const override { return "period_diff"; }
80  bool resolve_type(THD *) override {
81  fix_char_length(6); /* YYYYMM */
82  return false;
83  }
84 };
85 
87  public:
89  longlong val_int() override;
90  const char *func_name() const override { return "to_days"; }
91  enum Functype functype() const override { return TO_DAYS_FUNC; }
92  bool resolve_type(THD *) override {
93  fix_char_length(6);
94  maybe_null = true;
95  return false;
96  }
98  longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
99  bool check_partition_func_processor(uchar *) override { return false; }
101  return !has_date_args();
102  }
103 };
104 
106  public:
108  longlong val_int() override;
109  const char *func_name() const override { return "to_seconds"; }
110  bool resolve_type(THD *) override {
112  maybe_null = true;
113  return false;
114  }
116  longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
117  bool check_partition_func_processor(uchar *) override { return false; }
118 
119  bool intro_version(uchar *int_arg) override {
120  int *input_version = (int *)int_arg;
121  /* This function was introduced in 5.5 */
122  int output_version = std::max(*input_version, 50500);
123  *input_version = output_version;
124  return 0;
125  }
126 
127  /* Only meaningful with date part and optional time part */
129  return !has_date_args();
130  }
131 };
132 
134  public:
137 
138  longlong val_int() override;
139  const char *func_name() const override { return "dayofmonth"; }
140  enum Functype functype() const override { return DAY_FUNC; }
141  bool resolve_type(THD *) override {
142  fix_char_length(2); /* 1..31 */
143  maybe_null = true;
144  return false;
145  }
146  bool check_partition_func_processor(uchar *) override { return false; }
148  return !has_date_args();
149  }
150 };
151 
152 /**
153  TS-TODO: This should probably have Item_int_func as parent class.
154 */
156  public:
157  Item_func_month(const POS &pos, Item *a) : Item_func(pos, a) {
160  }
161  longlong val_int() override;
162  double val_real() override {
164  return (double)Item_func_month::val_int();
165  }
166  String *val_str(String *str) override {
167  longlong nr = val_int();
168  if (null_value) return 0;
169  str->set(nr, collation.collation);
170  return str;
171  }
172  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
173  return get_date_from_int(ltime, fuzzydate);
174  }
175  bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
176  const char *func_name() const override { return "month"; }
177  enum Functype functype() const override { return MONTH_FUNC; }
178  enum Item_result result_type() const override { return INT_RESULT; }
179  bool resolve_type(THD *) override {
180  fix_char_length(2);
181  maybe_null = true;
182  return false;
183  }
184  bool check_partition_func_processor(uchar *) override { return false; }
186  return !has_date_args();
187  }
188 };
189 
192 
193  public:
195  const char *func_name() const override { return "monthname"; }
196  String *val_str(String *str) override;
197  bool resolve_type(THD *thd) override;
198  bool check_partition_func_processor(uchar *) override { return true; }
200  return !has_date_args();
201  }
202 };
203 
205  public:
207  longlong val_int() override;
208  const char *func_name() const override { return "dayofyear"; }
209  bool resolve_type(THD *) override {
210  fix_char_length(3);
211  maybe_null = true;
212  return false;
213  }
214  bool check_partition_func_processor(uchar *) override { return false; }
216  return !has_date_args();
217  }
218 };
219 
221  public:
223  longlong val_int() override;
224  const char *func_name() const override { return "hour"; }
225  enum Functype functype() const override { return HOUR_FUNC; }
226  bool resolve_type(THD *) override {
227  fix_char_length(2); /* 0..23 */
228  maybe_null = true;
229  return false;
230  }
231  bool check_partition_func_processor(uchar *) override { return false; }
233  return !has_time_args();
234  }
235 };
236 
238  public:
240  longlong val_int() override;
241  const char *func_name() const override { return "minute"; }
242  enum Functype functype() const override { return MINUTE_FUNC; }
243  bool resolve_type(THD *) override {
244  fix_char_length(2); /* 0..59 */
245  maybe_null = true;
246  return false;
247  }
248  bool check_partition_func_processor(uchar *) override { return false; }
250  return !has_time_args();
251  }
252 };
253 
255  public:
257  longlong val_int() override;
258  const char *func_name() const override { return "quarter"; }
259  bool resolve_type(THD *) override {
260  fix_char_length(1); /* 1..4 */
261  maybe_null = true;
262  return false;
263  }
264  bool check_partition_func_processor(uchar *) override { return false; }
266  return !has_date_args();
267  }
268 };
269 
271  public:
273  longlong val_int() override;
274  const char *func_name() const override { return "second"; }
275  enum Functype functype() const override { return SECOND_FUNC; }
276  bool resolve_type(THD *) override {
277  fix_char_length(2); /* 0..59 */
278  maybe_null = true;
279  return false;
280  }
281  bool check_partition_func_processor(uchar *) override { return false; }
283  return !has_time_args();
284  }
285 };
286 
289 
290  public:
292  Item_func_week(const POS &pos, Item *a, Item *b) : super(pos, a, b) {}
293 
294  bool itemize(Parse_context *pc, Item **res) override;
295 
296  longlong val_int() override;
297  const char *func_name() const override { return "week"; }
298  enum Functype functype() const override { return WEEK_FUNC; }
299  bool resolve_type(THD *) override {
300  fix_char_length(2); /* 0..54 */
301  maybe_null = true;
302  return false;
303  }
304 };
305 
307  public:
309  : Item_int_func(pos, a, b) {}
310  longlong val_int() override;
311  const char *func_name() const override { return "yearweek"; }
312  bool resolve_type(THD *) override {
313  fix_char_length(6); /* YYYYWW */
314  maybe_null = true;
315  return false;
316  }
317  bool check_partition_func_processor(uchar *) override { return false; }
319  return !has_date_args();
320  }
321 };
322 
324  public:
326  longlong val_int() override;
327  const char *func_name() const override { return "year"; }
328  enum Functype functype() const override { return YEAR_FUNC; }
330  longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
331  bool resolve_type(THD *) override {
332  fix_char_length(5); /* 9999 plus sign */
333  maybe_null = true;
334  return false;
335  }
336  bool check_partition_func_processor(uchar *) override { return false; }
338  return !has_date_args();
339  }
340 };
341 
342 /**
343  TS-TODO: This should probably have Item_int_func as parent class.
344 */
345 class Item_func_weekday : public Item_func {
346  bool odbc_type;
347 
348  public:
349  Item_func_weekday(const POS &pos, Item *a, bool type_arg)
350  : Item_func(pos, a), odbc_type(type_arg) {
353  }
354  longlong val_int() override;
355  double val_real() override {
357  return static_cast<double>(val_int());
358  }
359  String *val_str(String *str) override {
360  DBUG_ASSERT(fixed == 1);
361  str->set(val_int(), &my_charset_bin);
362  return null_value ? 0 : str;
363  }
364  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
365  return get_date_from_int(ltime, fuzzydate);
366  }
367  bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
368  const char *func_name() const override {
369  return (odbc_type ? "dayofweek" : "weekday");
370  }
371  enum Functype functype() const override { return WEEKDAY_FUNC; }
372  enum Item_result result_type() const override { return INT_RESULT; }
373  bool resolve_type(THD *) override {
374  fix_char_length(1);
375  maybe_null = true;
376  return false;
377  }
378  bool check_partition_func_processor(uchar *) override { return false; }
380  return !has_date_args();
381  }
382 };
383 
384 /**
385  TS-TODO: Item_func_dayname should be derived from Item_str_func.
386  In the current implementation funny things can happen:
387  select dayname(now())+1 -> 4
388 */
391 
392  public:
394  const char *func_name() const override { return "dayname"; }
395  String *val_str(String *str) override;
396  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
397  return get_date_from_string(ltime, fuzzydate);
398  }
399  bool get_time(MYSQL_TIME *ltime) override {
400  return get_time_from_string(ltime);
401  }
402  enum Item_result result_type() const override { return STRING_RESULT; }
403  bool resolve_type(THD *thd) override;
404  bool check_partition_func_processor(uchar *) override { return true; }
405 };
406 
407 /*
408  Abstract class for functions returning "struct timeval".
409 */
410 class Item_timeval_func : public Item_func {
411  public:
412  explicit Item_timeval_func(const POS &pos) : Item_func(pos) {}
413 
415  Item_timeval_func(const POS &pos, Item *a) : Item_func(pos, a) {}
416  /**
417  Return timestamp in "struct timeval" format.
418  @param[out] tm The value is store here.
419  @retval false On success
420  @retval true On error
421  */
422  virtual bool val_timeval(struct timeval *tm) = 0;
423  longlong val_int() override;
424  double val_real() override;
425  String *val_str(String *str) override;
426  my_decimal *val_decimal(my_decimal *decimal_value) override;
427  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
428  return get_date_from_numeric(ltime, fuzzydate);
429  }
430  bool get_time(MYSQL_TIME *ltime) override {
431  return get_time_from_numeric(ltime);
432  }
433  enum Item_result result_type() const override {
435  }
436 };
437 
440 
441  public:
443 
445 
447  : Item_timeval_func(pos, a) {}
448 
449  const char *func_name() const override { return "unix_timestamp"; }
450 
451  bool itemize(Parse_context *pc, Item **res) override;
453  longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
454  bool check_partition_func_processor(uchar *) override { return false; }
455  /*
456  UNIX_TIMESTAMP() depends on the current timezone
457  (and thus may not be used as a partitioning function)
458  when its argument is NOT of the TIMESTAMP type.
459  */
461  return !has_timestamp_args();
462  }
463  bool resolve_type(THD *) override {
465  const uint8 dec = arg_count == 0 ? 0 : args[0]->datetime_precision();
466  if (dec > 0) {
467  set_data_type_decimal(11 + dec, dec);
468  } else {
470  max_length = 11;
471  }
472  return false;
473  }
474  bool val_timeval(struct timeval *tm) override;
475 
476  bool check_function_as_value_generator(uchar *p_arg) override {
477  /*
478  TODO: Allow UNIX_TIMESTAMP called with an argument to be a part
479  of the expression for a generated column too.
480  */
483  func_arg->banned_function_name = func_name();
484  return ((func_arg->source == VGS_GENERATED_COLUMN) ||
485  (func_arg->source == VGS_CHECK_CONSTRAINT));
486  }
487 };
488 
490  public:
492  : Item_int_func(pos, item) {}
493  longlong val_int() override;
494  const char *func_name() const override { return "time_to_sec"; }
495  bool resolve_type(THD *) override {
496  fix_char_length(10);
497  maybe_null = true;
498  return false;
499  }
500  bool check_partition_func_processor(uchar *) override { return false; }
502  return !has_time_args();
503  }
504 };
505 
506 /**
507  Abstract class for functions returning TIME, DATE, DATETIME types
508  whose data type is known at constructor time.
509 */
511  protected:
512  bool check_precision();
513 
514  public:
516  explicit Item_temporal_func(const POS &pos) : Item_func(pos) {}
517 
520 
521  Item_temporal_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {}
522 
523  Item_temporal_func(Item *a, Item *b, Item *c) : Item_func(a, b, c) {}
524  Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c)
525  : Item_func(pos, a, b, c) {}
526  Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
527  : Item_func(pos, a, b, c, d) {}
529  : Item_func(pos, list) {}
530 
531  Item_result result_type() const override { return STRING_RESULT; }
532  const CHARSET_INFO *charset_for_protocol() const override {
533  return &my_charset_bin;
534  }
535  Field *tmp_table_field(TABLE *table) override {
536  return tmp_table_field_from_field_type(table, 0);
537  }
538  uint time_precision() override {
540  return decimals;
541  }
544  return decimals;
545  }
546  void print(const THD *thd, String *str,
547  enum_query_type query_type) const override;
548 };
549 
550 /**
551  Abstract class for functions returning TIME, DATE, DATETIME or string values,
552  whose data type depends on parameters and is set at fix_field time.
553 */
555  protected:
556  sql_mode_t sql_mode; // sql_mode value is cached here in resolve_type()
557  String ascii_buf; // Conversion buffer
558  /**
559  Get "native" temporal value as MYSQL_TIME
560  @param[out] ltime The value is stored here.
561  @param[in] fuzzy_date Date flags.
562  @retval false On success.
563  @retval true On error.
564  */
565  virtual bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) = 0;
567  bool no_conversions) override;
568 
569  public:
571  : Item_str_func(a, b), sql_mode(0) {}
573  : Item_str_func(pos, a, b), sql_mode(0) {}
574 
575  Item_result result_type() const override { return STRING_RESULT; }
576  const CHARSET_INFO *charset_for_protocol() const override {
577  /*
578  Can return TIME, DATE, DATETIME or VARCHAR depending on arguments.
579  Send using "binary" when TIME, DATE or DATETIME,
580  or using collation.collation when VARCHAR
581  (which is fixed from @collation_connection in resolve_type()).
582  */
583  DBUG_ASSERT(fixed == 1);
585  : &my_charset_bin;
586  }
587  Field *tmp_table_field(TABLE *table) override {
588  return tmp_table_field_from_field_type(table, 0);
589  }
590  longlong val_int() override { return val_int_from_decimal(); }
591  double val_real() override { return val_real_from_decimal(); }
592  my_decimal *val_decimal(my_decimal *decimal_value) override;
593  /**
594  Return string value in ASCII character set.
595  */
596  String *val_str_ascii(String *str) override;
597  /**
598  Return string value in @@character_set_connection.
599  */
600  String *val_str(String *str) override {
602  }
603  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
604  bool get_time(MYSQL_TIME *ltime) override;
605 };
606 
607 /*
608  This can't be a Item_str_func, because the val_real() functions are special
609 */
610 
611 /**
612  Abstract class for functions returning DATE values.
613 */
615  protected:
617  return save_date_in_field(field);
618  }
619 
620  public:
624  }
628  }
629  Item_date_func(const POS &pos, Item *a, Item *b)
630  : Item_temporal_func(pos, a, b) {
632  }
633  bool get_time(MYSQL_TIME *ltime) override {
634  return get_time_from_date(ltime);
635  }
636  String *val_str(String *str) override { return val_string_from_date(str); }
637  longlong val_int() override { return val_int_from_date(); }
638  longlong val_date_temporal() override;
639  double val_real() override { return static_cast<double>(val_int()); }
640  const char *func_name() const override { return "date"; }
641  enum Functype functype() const override { return DATE_FUNC; }
642  bool resolve_type(THD *) override { return false; }
643  my_decimal *val_decimal(my_decimal *decimal_value) override {
644  DBUG_ASSERT(fixed == 1);
645  return val_decimal_from_date(decimal_value);
646  }
647  // All date functions must implement get_date()
648  // to avoid use of generic Item::get_date()
649  // which converts to string and then parses the string as DATE.
650  virtual bool get_date(MYSQL_TIME *res,
651  my_time_flags_t fuzzy_date) override = 0;
652 };
653 
654 /**
655  Abstract class for functions returning DATETIME values.
656 */
658  protected:
660  return save_date_in_field(field);
661  }
662 
663  public:
666  }
669  }
672  }
675  }
677  : Item_temporal_func(pos, a, b) {
679  }
682  }
683  Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c)
684  : Item_temporal_func(pos, a, b, c) {
686  }
687  Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
688  : Item_temporal_func(pos, a, b, c, d) {
690  }
694  }
695 
696  double val_real() override { return val_real_from_decimal(); }
697  String *val_str(String *str) override {
698  return val_string_from_datetime(str);
699  }
700  longlong val_int() override { return val_int_from_datetime(); }
701  longlong val_date_temporal() override;
702  my_decimal *val_decimal(my_decimal *decimal_value) override {
703  DBUG_ASSERT(fixed == 1);
704  return val_decimal_from_date(decimal_value);
705  }
706  bool get_time(MYSQL_TIME *ltime) override {
707  return get_time_from_datetime(ltime);
708  }
709  // All datetime functions must implement get_date()
710  // to avoid use of generic Item::get_date()
711  // which converts to string and then parses the string as DATETIME.
712  virtual bool get_date(MYSQL_TIME *res,
713  my_time_flags_t fuzzy_date) override = 0;
714 };
715 
716 /**
717  Abstract class for functions returning TIME values.
718 */
720  protected:
722  return save_time_in_field(field);
723  }
724 
725  public:
729  }
732  }
735  }
736  Item_time_func(const POS &pos, Item *a, Item *b)
737  : Item_temporal_func(pos, a, b) {
739  }
740  Item_time_func(const POS &pos, Item *a, Item *b, Item *c)
741  : Item_temporal_func(pos, a, b, c) {
743  }
744  double val_real() override { return val_real_from_decimal(); }
745  my_decimal *val_decimal(my_decimal *decimal_value) override {
747  return val_decimal_from_time(decimal_value);
748  }
749  longlong val_int() override { return val_int_from_time(); }
750  longlong val_time_temporal() override;
751  bool get_date(MYSQL_TIME *res, my_time_flags_t) override {
752  return get_date_from_time(res);
753  }
754  String *val_str(String *str) override { return val_string_from_time(str); }
755  // All time functions must implement get_time()
756  // to avoid use of generic Item::get_time()
757  // which converts to string and then parses the string as TIME.
758  virtual bool get_time(MYSQL_TIME *res) override = 0;
759 };
760 
761 /**
762  Cache for MYSQL_TIME value with various representations.
763 
764  - MYSQL_TIME representation (time) is initialized during set_XXX().
765  - Packed representation (time_packed) is also initialized during set_XXX().
766  - String representation (string_buff) is also initialized during set_XXX();
767 */
769  MYSQL_TIME time; ///< MYSQL_TIME representation
770  longlong time_packed; ///< packed representation
771  char string_buff[MAX_DATE_STRING_REP_LENGTH]; ///< string representation
772  uint string_length; ///< length of string
773  uint8 dec; ///< Number of decimals
774 
775  /**
776  Store MYSQL_TIME representation into the given MYSQL_TIME variable.
777  */
778  void get_TIME(MYSQL_TIME *ltime) const {
780  *ltime = time;
781  }
782 
783  public:
786  string_buff[0] = '\0';
787  }
788  /**
789  Set time and time_packed from a DATE value.
790  */
791  void set_date(MYSQL_TIME *ltime);
792  /**
793  Set time and time_packed from a TIME value.
794  */
795  void set_time(MYSQL_TIME *ltime, uint8 dec_arg);
796  /**
797  Set time and time_packed from a DATETIME value.
798  */
799  void set_datetime(MYSQL_TIME *ltime, uint8 dec_arg);
800  /**
801  Set time and time_packed according to DATE value
802  in "struct timeval" representation and its time zone.
803  */
804  void set_date(struct timeval tv, Time_zone *tz);
805  /**
806  Set time and time_packed according to TIME value
807  in "struct timeval" representation and its time zone.
808  */
809  void set_time(struct timeval tv, uint8 dec_arg, Time_zone *tz);
810  /**
811  Set time and time_packed according to DATETIME value
812  in "struct timeval" representation and its time zone.
813  */
814  void set_datetime(struct timeval tv, uint8 dec_arg, Time_zone *tz);
815  /**
816  Test if cached value is equal to another MYSQL_TIME_cache value.
817  */
818  bool eq(const MYSQL_TIME_cache &tm) const {
819  return val_packed() == tm.val_packed();
820  }
821 
822  /**
823  Return number of decimal digits.
824  */
825  uint8 decimals() const {
827  return dec;
828  }
829 
830  /**
831  Return packed representation.
832  */
835  return time_packed;
836  }
837  /**
838  Store MYSQL_TIME representation into the given date/datetime variable
839  checking date flags.
840  */
841  bool get_date(MYSQL_TIME *ltime, uint fuzzyflags) const;
842  /**
843  Store MYSQL_TIME representation into the given time variable.
844  */
845  bool get_time(MYSQL_TIME *ltime) const {
846  get_TIME(ltime);
847  return false;
848  }
849  /**
850  Return pointer to MYSQL_TIME representation.
851  */
854  return &time;
855  }
856  /**
857  Store string representation into String.
858  */
859  String *val_str(String *str);
860  /**
861  Return C string representation.
862  */
863  const char *cptr() const { return string_buff; }
864 };
865 
866 /**
867  DATE'2010-01-01'
868 */
871 
872  public:
873  /**
874  Constructor for Item_date_literal.
875  @param ltime DATE value.
876  */
878  cached_time.set_date(ltime);
880  fixed = true;
881  }
882  const char *func_name() const override { return "date_literal"; }
883  void print(const THD *thd, String *str,
884  enum_query_type query_type) const override;
887  return cached_time.val_packed();
888  }
889  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override {
891  return cached_time.get_date(ltime, fuzzy_date);
892  }
893  String *val_str(String *str) override {
895  return cached_time.val_str(str);
896  }
897  bool resolve_type(THD *) override { return false; }
898  bool check_partition_func_processor(uchar *) override { return false; }
899  bool basic_const_item() const override { return true; }
900  table_map used_tables() const override { return 0; }
901  table_map not_null_tables() const override { return used_tables(); }
902  void cleanup() override {
903  // See Item_basic_const::cleanup()
905  }
906  bool eq(const Item *item, bool binary_cmp) const override;
907 };
908 
909 /**
910  TIME'10:10:10'
911 */
914 
915  public:
916  /**
917  Constructor for Item_time_literal.
918  @param ltime TIME value.
919  @param dec_arg number of fractional digits in ltime.
920  */
921  Item_time_literal(MYSQL_TIME *ltime, uint dec_arg) {
923  cached_time.set_time(ltime, decimals);
924  fixed = true;
925  }
926  const char *func_name() const override { return "time_literal"; }
927  void print(const THD *thd, String *str,
928  enum_query_type query_type) const override;
931  return cached_time.val_packed();
932  }
933  bool get_time(MYSQL_TIME *ltime) override {
935  return cached_time.get_time(ltime);
936  }
937  String *val_str(String *str) override {
939  return cached_time.val_str(str);
940  }
941  bool resolve_type(THD *) override { return false; }
942  bool check_partition_func_processor(uchar *) override { return false; }
943  bool basic_const_item() const override { return true; }
944  table_map used_tables() const override { return 0; }
945  table_map not_null_tables() const override { return used_tables(); }
946  void cleanup() override {
947  // See Item_basic_const::cleanup()
949  }
950  bool eq(const Item *item, bool binary_cmp) const override;
951 };
952 
953 /**
954  TIMESTAMP'2001-01-01 10:20:30'
955 */
958 
959  public:
960  /**
961  Constructor for Item_datetime_literal.
962  @param ltime DATETIME value.
963  @param dec_arg number of fractional digits in ltime.
964  */
968  fixed = true;
969  }
970  const char *func_name() const override { return "datetime_literal"; }
971  enum Functype functype() const override { return DATETIME_LITERAL; }
972  void print(const THD *thd, String *str,
973  enum_query_type query_type) const override;
976  return cached_time.val_packed();
977  }
978  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override {
980  return cached_time.get_date(ltime, fuzzy_date);
981  }
982  String *val_str(String *str) override {
984  return cached_time.val_str(str);
985  }
986  bool resolve_type(THD *) override { return false; }
987  bool check_partition_func_processor(uchar *) override { return false; }
988  bool basic_const_item() const override { return true; }
989  table_map used_tables() const override { return 0; }
990  table_map not_null_tables() const override { return used_tables(); }
991  void cleanup() override {
992  // See Item_basic_const::cleanup()
994  }
995  bool eq(const Item *item, bool binary_cmp) const override;
996 };
997 
998 /// Abstract CURTIME function. Children should define what time zone is used.
1001 
1002  MYSQL_TIME_cache cached_time; // Initialized in resolve_type()
1003  protected:
1004  // Abstract method that defines which time zone is used for conversion.
1005  virtual Time_zone *time_zone() = 0;
1006 
1007  public:
1008  /**
1009  Constructor for Item_func_curtime.
1010  @param pos Position of token in the parser.
1011  @param dec_arg Number of fractional digits.
1012  */
1014  decimals = dec_arg;
1015  }
1016 
1017  bool itemize(Parse_context *pc, Item **res) override;
1018 
1019  bool resolve_type(THD *thd) override;
1021  DBUG_ASSERT(fixed == 1);
1022  return cached_time.val_packed();
1023  }
1024  bool get_time(MYSQL_TIME *ltime) override {
1025  DBUG_ASSERT(fixed == 1);
1026  return cached_time.get_time(ltime);
1027  }
1028  String *val_str(String *) override {
1029  DBUG_ASSERT(fixed == 1);
1030  return cached_time.val_str(&str_value);
1031  }
1032  bool check_function_as_value_generator(uchar *checker_args) override {
1035  checker_args);
1036  func_arg->banned_function_name = func_name();
1037  return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1038  (func_arg->source == VGS_CHECK_CONSTRAINT));
1039  }
1040 };
1041 
1043  protected:
1044  Time_zone *time_zone() override;
1045 
1046  public:
1048  : Item_func_curtime(pos, dec_arg) {}
1049  const char *func_name() const override { return "curtime"; }
1050 };
1051 
1053  protected:
1054  Time_zone *time_zone() override;
1055 
1056  public:
1058  : Item_func_curtime(pos, dec_arg) {}
1059  const char *func_name() const override { return "utc_time"; }
1060 };
1061 
1062 /**
1063  Abstract CURDATE function.
1064 
1065  @sa Item_func_curtime
1066  */
1069 
1070  MYSQL_TIME_cache cached_time; // Initialized in resolve_type()
1071  protected:
1072  virtual Time_zone *time_zone() = 0;
1073 
1074  public:
1075  explicit Item_func_curdate(const POS &pos) : Item_date_func(pos) {}
1076 
1077  bool itemize(Parse_context *pc, Item **res) override;
1078 
1079  bool resolve_type(THD *) override;
1081  DBUG_ASSERT(fixed == 1);
1082  return cached_time.val_packed();
1083  }
1084  bool get_date(MYSQL_TIME *res, my_time_flags_t) override {
1085  DBUG_ASSERT(fixed == 1);
1086  return cached_time.get_time(res);
1087  }
1088  String *val_str(String *) override {
1089  DBUG_ASSERT(fixed == 1);
1090  return cached_time.val_str(&str_value);
1091  }
1092  bool check_function_as_value_generator(uchar *checker_args) override {
1095  checker_args);
1096  func_arg->banned_function_name = func_name();
1097  return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1098  (func_arg->source == VGS_CHECK_CONSTRAINT));
1099  }
1100 };
1101 
1103  protected:
1104  Time_zone *time_zone() override;
1105 
1106  public:
1108  const char *func_name() const override { return "curdate"; }
1109 };
1110 
1112  protected:
1113  Time_zone *time_zone() override;
1114 
1115  public:
1117  const char *func_name() const override { return "utc_date"; }
1118 };
1119 
1120 /**
1121  Abstract CURRENT_TIMESTAMP function.
1122 
1123  @sa Item_func_curtime
1124 */
1127 
1128  protected:
1129  virtual Time_zone *time_zone() = 0;
1131  bool no_conversions) override;
1132 
1133  public:
1134  /**
1135  Constructor for Item_func_now.
1136  @param dec_arg Number of fractional digits.
1137  */
1138  Item_func_now(uint8 dec_arg) : Item_datetime_func() { decimals = dec_arg; }
1140  decimals = dec_arg;
1141  }
1142 
1143  bool resolve_type(THD *) override;
1145  DBUG_ASSERT(fixed == 1);
1146  return cached_time.val_packed();
1147  }
1148  bool get_date(MYSQL_TIME *res, my_time_flags_t) override {
1149  DBUG_ASSERT(fixed == 1);
1150  return cached_time.get_time(res);
1151  }
1152  String *val_str(String *) override {
1153  DBUG_ASSERT(fixed == 1);
1154  return cached_time.val_str(&str_value);
1155  }
1156  bool check_function_as_value_generator(uchar *checker_args) override {
1159  checker_args);
1160  func_arg->banned_function_name = func_name();
1161  return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1162  (func_arg->source == VGS_CHECK_CONSTRAINT));
1163  }
1164 };
1165 
1167  protected:
1168  Time_zone *time_zone() override;
1169 
1170  public:
1171  /**
1172  Stores the query start time in a field, truncating to the field's number
1173  of fractional second digits.
1174 
1175  @param field The field to store in.
1176  */
1177  static void store_in(Field *field);
1178 
1179  Item_func_now_local(uint8 dec_arg) : Item_func_now(dec_arg) {}
1181  : Item_func_now(pos, dec_arg) {}
1182 
1183  const char *func_name() const override { return "now"; }
1184  enum Functype functype() const override { return NOW_FUNC; }
1185 };
1186 
1189 
1190  protected:
1191  Time_zone *time_zone() override;
1192 
1193  public:
1194  Item_func_now_utc(const POS &pos, uint8 dec_arg)
1195  : Item_func_now(pos, dec_arg) {}
1196 
1197  bool itemize(Parse_context *pc, Item **res) override;
1198 
1199  const char *func_name() const override { return "utc_timestamp"; }
1200 };
1201 
1202 /**
1203  SYSDATE() is like NOW(), but always uses the real current time, not the
1204  query_start(). This matches the Oracle behavior.
1205 */
1207  public:
1209  decimals = dec_arg;
1210  }
1211  const char *func_name() const override { return "sysdate"; }
1212  bool resolve_type(THD *) override;
1213  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1214  /**
1215  This function is non-deterministic and hence depends on the 'RAND'
1216  pseudo-table.
1217 
1218  @retval Always RAND_TABLE_BIT
1219  */
1221  return RAND_TABLE_BIT;
1222  }
1223 };
1224 
1226  public:
1228  const char *func_name() const override { return "from_days"; }
1229  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1230  bool check_partition_func_processor(uchar *) override { return false; }
1232  return has_date_args() || has_time_args();
1233  }
1234 };
1235 
1238  const bool is_time_format;
1240 
1241  public:
1243  bool is_time_format_arg = false)
1244  : Item_str_func(pos, a, b), is_time_format(is_time_format_arg) {}
1245  String *val_str(String *str) override;
1246  const char *func_name() const override {
1247  return is_time_format ? "time_format" : "date_format";
1248  }
1249  bool resolve_type(THD *thd) override;
1250  uint format_length(const String *format);
1251  bool eq(const Item *item, bool binary_cmp) const override;
1252 };
1253 
1255  public:
1257  : Item_datetime_func(pos, a) {}
1258  const char *func_name() const override { return "from_unixtime"; }
1259  bool resolve_type(THD *thd) override;
1260  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1261 };
1262 
1263 /*
1264  This class represents CONVERT_TZ() function.
1265  The important fact about this function that it is handled in special way.
1266  When such function is met in expression time_zone system tables are added
1267  to global list of tables to open, so later those already opened and locked
1268  tables can be used during this function calculation for loading time zone
1269  descriptions.
1270 */
1272  /*
1273  If time zone parameters are constants we are caching objects that
1274  represent them (we use separate from_tz_cached/to_tz_cached members
1275  to indicate this fact, since NULL is legal value for from_tz/to_tz
1276  members.
1277  */
1280 
1281  public:
1283  : Item_datetime_func(pos, a, b, c), from_tz_cached(0), to_tz_cached(0) {}
1284  const char *func_name() const override { return "convert_tz"; }
1285  bool resolve_type(THD *) override;
1286  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1287  void cleanup() override;
1288 };
1289 
1291  public:
1293  : Item_time_func(pos, item) {}
1294  bool resolve_type(THD *) override {
1296  maybe_null = true;
1297  return false;
1298  }
1299  const char *func_name() const override { return "sec_to_time"; }
1300  bool get_time(MYSQL_TIME *ltime) override;
1301 };
1302 
1303 extern const char *interval_names[];
1304 
1307  bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date);
1308  bool get_time_internal(MYSQL_TIME *res);
1309 
1310  protected:
1311  bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1312 
1313  public:
1314  const interval_type int_type; // keep it public
1315  const bool date_sub_interval; // keep it public
1317  interval_type type_arg, bool neg_arg)
1318  : Item_temporal_hybrid_func(pos, a, b),
1319  int_type(type_arg),
1320  date_sub_interval(neg_arg) {}
1321  /**
1322  POS-less ctor for post-parse construction with implicit addition to THD's
1323  free_list (see Item::Item() no-argument ctor).
1324  */
1325  Item_date_add_interval(Item *a, Item *b, interval_type type_arg, bool neg_arg)
1326  : Item_temporal_hybrid_func(a, b),
1327  int_type(type_arg),
1328  date_sub_interval(neg_arg) {}
1329  const char *func_name() const override { return "date_add_interval"; }
1330  enum Functype functype() const override { return DATEADD_FUNC; }
1331  bool resolve_type(THD *) override;
1332  bool eq(const Item *item, bool binary_cmp) const override;
1333  void print(const THD *thd, String *str,
1334  enum_query_type query_type) const override;
1335 };
1336 
1339 
1340  public:
1341  const interval_type int_type; // keep it public
1342  Item_extract(const POS &pos, interval_type type_arg, Item *a)
1343  : Item_int_func(pos, a), int_type(type_arg) {}
1344  longlong val_int() override;
1345  enum Functype functype() const override { return EXTRACT_FUNC; }
1346  const char *func_name() const override { return "extract"; }
1347  bool resolve_type(THD *) override;
1348  bool eq(const Item *item, bool binary_cmp) const override;
1349  void print(const THD *thd, String *str,
1350  enum_query_type query_type) const override;
1351  bool check_partition_func_processor(uchar *) override { return false; }
1353  switch (int_type) {
1354  case INTERVAL_YEAR:
1355  case INTERVAL_YEAR_MONTH:
1356  case INTERVAL_QUARTER:
1357  case INTERVAL_MONTH:
1358  /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
1359  case INTERVAL_DAY:
1360  return !has_date_args();
1361  case INTERVAL_DAY_HOUR:
1362  case INTERVAL_DAY_MINUTE:
1363  case INTERVAL_DAY_SECOND:
1365  return !has_datetime_args();
1366  case INTERVAL_HOUR:
1367  case INTERVAL_HOUR_MINUTE:
1368  case INTERVAL_HOUR_SECOND:
1369  case INTERVAL_MINUTE:
1371  case INTERVAL_SECOND:
1372  case INTERVAL_MICROSECOND:
1376  return !has_time_args();
1377  default:
1378  /*
1379  INTERVAL_LAST is only an end marker,
1380  INTERVAL_WEEK depends on default_week_format which is a session
1381  variable and cannot be used for partitioning. See bug#57071.
1382  */
1383  break;
1384  }
1385  return true;
1386  }
1387 };
1388 
1390  public:
1393  maybe_null = 1;
1394  }
1395 
1396  void print(const THD *thd, String *str,
1397  enum_query_type query_type) const override;
1398  const char *func_name() const override { return "cast_as_date"; }
1399  enum Functype functype() const override { return TYPECAST_FUNC; }
1400  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1401  const char *cast_type() const { return "date"; }
1402 };
1403 
1406 
1407  public:
1410  }
1413  }
1414 
1415  Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
1416  : Item_time_func(pos, a) {
1417  detect_precision_from_arg = false;
1418  decimals = dec_arg;
1419  }
1420  void print(const THD *thd, String *str,
1421  enum_query_type query_type) const override;
1422  const char *func_name() const override { return "cast_as_time"; }
1423  enum Functype functype() const override { return TYPECAST_FUNC; }
1424  bool get_time(MYSQL_TIME *ltime) override;
1425  const char *cast_type() const { return "time"; }
1426  bool resolve_type(THD *) override {
1428  : decimals);
1429  maybe_null = true;
1430  return false;
1431  }
1432 };
1433 
1436 
1437  public:
1440  }
1443  }
1444 
1445  Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
1446  : Item_datetime_func(pos, a) {
1447  detect_precision_from_arg = false;
1448  decimals = dec_arg;
1449  }
1450  void print(const THD *thd, String *str,
1451  enum_query_type query_type) const override;
1452  const char *func_name() const override { return "cast_as_datetime"; }
1453  enum Functype functype() const override { return TYPECAST_FUNC; }
1454  const char *cast_type() const { return "datetime"; }
1455  bool resolve_type(THD *) override {
1458  maybe_null = true;
1459  return false;
1460  }
1461  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1462 };
1463 
1465  public:
1467  : Item_date_func(pos, a, b) {
1468  maybe_null = true;
1469  }
1470  const char *func_name() const override { return "makedate"; }
1471  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1472 };
1473 
1475  const bool is_date;
1476  int sign;
1477  bool val_datetime(MYSQL_TIME *time, my_time_flags_t fuzzy_date) override;
1478 
1479  public:
1480  Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
1481  : Item_temporal_hybrid_func(a, b), is_date(type_arg) {
1482  sign = neg_arg ? -1 : 1;
1483  }
1484  Item_func_add_time(const POS &pos, Item *a, Item *b, bool type_arg,
1485  bool neg_arg)
1486  : Item_temporal_hybrid_func(pos, a, b), is_date(type_arg) {
1487  sign = neg_arg ? -1 : 1;
1488  }
1489 
1491  : Item_func_add_time(pos, a, b, false, false) {}
1492 
1493  bool resolve_type(THD *) override;
1494  void print(const THD *thd, String *str,
1495  enum_query_type query_type) const override;
1496  const char *func_name() const override { return "add_time"; }
1497 };
1498 
1500  public:
1502  : Item_time_func(pos, a, b) {}
1503  const char *func_name() const override { return "timediff"; }
1504  bool resolve_type(THD *) override {
1506  MY_MAX(args[0]->time_precision(), args[1]->time_precision()));
1507  maybe_null = true;
1508  return false;
1509  }
1510  bool get_time(MYSQL_TIME *ltime) override;
1511 };
1512 
1514  public:
1515  Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
1516  : Item_time_func(pos, a, b, c) {
1517  maybe_null = true;
1518  }
1519  bool resolve_type(THD *) override {
1521  return false;
1522  }
1523  const char *func_name() const override { return "maketime"; }
1524  bool get_time(MYSQL_TIME *ltime) override;
1525 };
1526 
1528  public:
1530  longlong val_int() override;
1531  const char *func_name() const override { return "microsecond"; }
1532  enum Functype functype() const override { return MICROSECOND_FUNC; }
1533  bool resolve_type(THD *) override {
1534  maybe_null = true;
1535  return false;
1536  }
1537  bool check_partition_func_processor(uchar *) override { return false; }
1539  return !has_time_args();
1540  }
1541 };
1542 
1545 
1546  public:
1548  interval_type type_arg)
1549  : Item_int_func(pos, a, b), int_type(type_arg) {}
1550  const char *func_name() const override { return "timestampdiff"; }
1551  enum Functype functype() const override { return TIMESTAMPDIFF_FUNC; }
1553  longlong val_int() override;
1554  bool resolve_type(THD *) override {
1555  maybe_null = true;
1556  return false;
1557  }
1558  void print(const THD *thd, String *str,
1559  enum_query_type query_type) const override;
1560 };
1561 
1568 };
1569 
1571  public:
1572  const enum_mysql_timestamp_type type; // keep it public
1574  Item *a)
1575  : Item_str_ascii_func(pos, a), type(type_arg) {}
1576  String *val_str_ascii(String *str) override;
1577  const char *func_name() const override { return "get_format"; }
1578  bool resolve_type(THD *) override {
1579  maybe_null = true;
1581  return false;
1582  }
1583  void print(const THD *thd, String *str,
1584  enum_query_type query_type) const override;
1585 };
1586 
1589  void fix_from_format(const char *format, size_t length);
1590 
1591  protected:
1592  bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override;
1593 
1594  public:
1596  : Item_temporal_hybrid_func(pos, a, b) {}
1597  const char *func_name() const override { return "str_to_date"; }
1598  bool resolve_type(THD *) override;
1599 };
1600 
1602  public:
1604  maybe_null = true;
1605  }
1606  const char *func_name() const override { return "last_day"; }
1607  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1608 };
1609 
1612 
1613  public:
1615  : Item_datetime_func(pos, list) {}
1616  enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1617  const char *func_name() const override { return "internal_update_time"; }
1618  bool resolve_type(THD *thd) override;
1619  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1620 };
1621 
1624 
1625  public:
1627  : Item_datetime_func(pos, list) {}
1628  enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1629  const char *func_name() const override { return "internal_check_time"; }
1630  bool resolve_type(THD *thd) override;
1631  bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override;
1632 };
1633 
1634 /* Function prototypes */
1635 
1636 bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time,
1638 
1639 #endif /* ITEM_TIMEFUNC_INCLUDED */
const char * func_name() const override
Definition: item_timefunc.h:1108
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:2539
Item_date_func super
Definition: item_timefunc.h:1068
enum Functype functype() const override
Definition: item_timefunc.h:275
enum monotonicity_info enum_monotonicity_info
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1455
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:501
enum enum_mysql_timestamp_type time_type
Definition: mysql_time.h:68
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:337
Item_result result_type() const override
Definition: item_timefunc.h:531
Some common macros.
Time_zone * time_zone() override
Definition: item_timefunc.cc:1701
Item_datetime_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:676
String * val_str(String *) override
Definition: item_timefunc.h:1088
longlong val_int() override
Returns the second in time_exp in the range of 0 - 59.
Definition: item_timefunc.cc:1198
const char * func_name() const override
Definition: item_timefunc.h:970
Definition: my_time.h:391
Item_name_string item_name
Name from query.
Definition: item.h:2650
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:2472
bool from_tz_cached
Definition: item_timefunc.h:1278
not valid for UDFs
Definition: udf_registration_types.h:44
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1433
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:199
Item_func_now(uint8 dec_arg)
Constructor for Item_func_now.
Definition: item_timefunc.h:1138
longlong val_int() override
Definition: item_timefunc.cc:1305
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1215
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:80
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:2462
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:399
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:923
Abstract class for functions returning TIME, DATE, DATETIME or string values, whose data type depends...
Definition: item_timefunc.h:554
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:249
Item_typecast_time(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1415
unsigned char uchar
Definition: my_inttypes.h:51
Item_datetime_func(Item *a, Item *b, Item *c)
Definition: item_timefunc.h:680
date_time_format
Definition: item_timefunc.h:1562
Our own string classes, used pervasively throughout the executor.
static int interval
Definition: mysqladmin.cc:64
enum Functype functype() const override
Definition: item_timefunc.h:1399
Definition: item_timefunc.h:306
Item_func_sysdate_local(uint8 dec_arg)
Definition: item_timefunc.h:1208
"public" interface to sys_var - server configuration variables.
Item_result
Type of the user defined function return slot and arguments
Definition: udf_registration_types.h:38
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1325
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:941
not valid for UDFs
Definition: udf_registration_types.h:40
bool get_time(MYSQL_TIME *ltime) const
Store MYSQL_TIME representation into the given time variable.
Definition: item_timefunc.h:845
String * val_str(String *str) override
Definition: item_timefunc.cc:1395
Item_func_monthname(const POS &pos, Item *a)
Definition: item_timefunc.h:194
Definition: item_timefunc.h:1236
longlong time_packed
packed representation
Definition: item_timefunc.h:770
ulonglong table_map
Definition: my_table_map.h:32
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:943
Definition: my_time.h:400
enum_field_types data_type() const
Retrieve the derived data type of the Item.
Definition: item.h:1009
void set_date(MYSQL_TIME *ltime)
Set time and time_packed from a DATE value.
Definition: item_timefunc.cc:1631
String * val_str(String *) override
Definition: item_timefunc.h:1028
T pointer_cast(void *p)
Casts from one pointer type, to another, without using reinterpret_cast or C-style cast: foo f; bar *...
Definition: template_utils.h:70
Abstract CURDATE function.
Definition: item_timefunc.h:1067
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:367
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:259
String * val_str(String *str) override
Definition: item_timefunc.h:359
const char * func_name() const override
Definition: item_timefunc.h:1531
const char * func_name() const override
Definition: item_timefunc.h:1228
void get_TIME(MYSQL_TIME *ltime) const
Store MYSQL_TIME representation into the given MYSQL_TIME variable.
Definition: item_timefunc.h:778
String * val_str_ascii(String *str) override
Definition: item_timefunc.cc:2945
Definition: item_timefunc.h:1404
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:172
const char * func_name() const override
Definition: item_timefunc.h:926
table_map used_tables() const override
Definition: item_timefunc.h:989
table_map not_null_tables() const override
Definition: item_timefunc.h:945
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:232
Definition: my_time.h:401
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:331
const char * func_name() const override
Definition: item_timefunc.h:1503
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.h:1020
Item_func_sec_to_time(const POS &pos, Item *item)
Definition: item_timefunc.h:1292
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_timefunc.cc:1210
uint8 decimals
Number of decimals in result when evaluating this item.
Definition: item.h:2720
Definition: item_timefunc.h:105
Item_time_func(const POS &pos)
Definition: item_timefunc.h:727
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:987
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 resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:897
void fix_char_length(uint32 max_char_length_arg)
Definition: item.h:2485
Item_func_time_to_sec(const POS &pos, Item *item)
Definition: item_timefunc.h:491
longlong val_int_from_date()
Definition: item.cc:443
double val_real() override
Definition: item_timefunc.h:744
File containing constants that can be used throughout the server.
Definition: item_timefunc.h:287
bool date_value
Definition: item_timefunc.h:1338
Item_func_get_format(const POS &pos, enum_mysql_timestamp_type type_arg, Item *a)
Definition: item_timefunc.h:1573
const char * func_name() const override
Definition: item_timefunc.h:311
const bool is_time_format
Definition: item_timefunc.h:1238
Some integer typedefs for easier portability.
Definition: item_timefunc.h:1434
Definition: item_timefunc.h:237
const char * func_name() const override
Definition: item_timefunc.h:224
Item_func_unix_timestamp(const POS &pos)
Definition: item_timefunc.h:442
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:1457
my_decimal * val_decimal_from_time(my_decimal *decimal_value)
Definition: item.cc:343
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:1126
MYSQL_TIME time
MYSQL_TIME representation.
Definition: item_timefunc.h:769
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.cc:909
const char * func_name() const override
Definition: item_timefunc.h:1422
Definition: my_time.h:396
TIMESTAMP&#39;2001-01-01 10:20:30&#39;.
Definition: item_timefunc.h:956
bool detect_precision_from_arg
Definition: item_timefunc.h:1435
Item_func_str_to_date(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1595
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:1144
Definition: item_timefunc.h:1052
Definition: mysql_time.h:45
sql_mode_t sql_mode
Definition: item_timefunc.h:556
Item_func_date_format(const POS &pos, Item *a, Item *b, bool is_time_format_arg=false)
Definition: item_timefunc.h:1242
table_map used_tables() const override
Definition: item_timefunc.h:900
Item_func_convert_tz(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1282
Item_func_curtime_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1047
Item_func_unix_timestamp(const POS &pos, Item *a)
Definition: item_timefunc.h:446
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:317
Item_func_dayofmonth(const POS &pos, Item *a)
Definition: item_timefunc.h:136
Item_time_func()
Definition: item_timefunc.h:726
Item_datetime_func(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:691
Definition: item_timefunc.h:1587
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1967
uint8 decimals() const
Return number of decimal digits.
Definition: item_timefunc.h:825
Definition: item_timefunc.h:1102
Definition: field.h:700
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3170
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:1002
Definition: item_func.h:82
Definition: field_types.h:68
Item_temporal_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:521
Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
Definition: item_timefunc.h:1480
Definition: item_timefunc.h:1271
bool detect_precision_from_arg
Definition: item_timefunc.h:1405
THD * thd
Definition: item_timefunc.h:1611
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1059
void cleanup() override
Definition: item_timefunc.h:946
Definition: item_timefunc.h:1513
double val_real() override
Definition: item_timefunc.h:696
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:706
const char * func_name() const override
Definition: item_timefunc.h:327
Item_func_timestamp_diff(const POS &pos, Item *a, Item *b, interval_type type_arg)
Definition: item_timefunc.h:1547
Item_date_func()
Definition: item_timefunc.h:621
uint arg_count
Definition: item_func.h:110
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:281
Value_generator_source source
Definition: item.h:494
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:175
const char * func_name() const override
Definition: item_timefunc.h:368
enum Functype functype() const override
Definition: item_timefunc.h:225
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2236
const char * func_name() const override
Definition: item_timefunc.h:494
enum Functype functype() const override
Definition: item_timefunc.h:1616
const char * func_name() const override
Definition: item_timefunc.h:1346
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:318
my_decimal * val_decimal_from_date(my_decimal *decimal_value)
Definition: item.cc:328
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:231
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2645
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:832
Definition: item_func.h:200
void set_data_type_datetime(uint8 fsp)
Set all properties for Item of DATETIME type.
Definition: item.h:1193
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:1080
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:933
Definition: item_func.h:205
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:68
Definition: item_timefunc.h:1254
const char * cast_type() const
Definition: item_timefunc.h:1425
int fixed_length
Definition: item_timefunc.h:1237
const interval_type int_type
Definition: item_timefunc.h:1314
Definition: my_time.h:402
class udf_list * list
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:265
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:2674
Item_func_week(Item *a, Item *b)
Definition: item_timefunc.h:291
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:379
Item_timeval_func(Item *a)
Definition: item_timefunc.h:414
Definition: item_timefunc.h:1566
enum_mysql_timestamp_type cached_timestamp_type
Definition: item_timefunc.h:1588
Item_func_dayofmonth(Item *a)
Definition: item_timefunc.h:135
#define RAND_TABLE_BIT
Definition: sql_const.h:114
Definition: item_func.h:211
Item_time_func(Item *a)
Definition: item_timefunc.h:730
const char * func_name() const override
Definition: item_timefunc.h:1258
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:2484
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1274
Item_func_makedate(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1466
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:986
Item_datetime_func(const POS &pos)
Definition: item_timefunc.h:667
Item_func_minute(const POS &pos, Item *a)
Definition: item_timefunc.h:239
const char * func_name() const override
Definition: item_timefunc.h:449
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:117
longlong val_int() override
Definition: item_timefunc.cc:1260
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:51
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:96
enum Functype functype() const override
Definition: item_timefunc.h:1628
const char * func_name() const override
Definition: item_timefunc.h:241
static char str_value[32]
Definition: test_status_var_service_reg_only.cc:45
const CHARSET_INFO * charset_for_protocol() const override
Definition: item_timefunc.h:576
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2493
Item_date_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:629
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:30
enum Functype functype() const override
Definition: item_timefunc.h:177
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:1070
Definition: my_time.h:387
Definition: item_timefunc.h:1543
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:128
Definition: item_timefunc.h:74
DATE&#39;2010-01-01&#39;.
Definition: item_timefunc.h:869
String * val_str(String *str) override
Definition: item_timefunc.h:893
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:161
Item_temporal_func(const POS &pos)
Definition: item_timefunc.h:516
longlong val_int() override
Definition: item_timefunc.cc:1360
const char * func_name() const override
Definition: item_timefunc.h:195
Item_date_literal(MYSQL_TIME *ltime)
Constructor for Item_date_literal.
Definition: item_timefunc.h:877
Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_timefunc.h:687
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1078
String * val_str(String *str)
Store string representation into String.
Definition: item_timefunc.cc:1681
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:633
longlong val_int() override
Definition: item_timefunc.cc:1141
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1069
virtual const char * func_name() const =0
static const CHARSET_INFO * default_charset()
Definition: item.cc:1387
longlong val_int() override
Definition: item_timefunc.cc:988
virtual Time_zone * time_zone()=0
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:185
type_conversion_status save_time_in_field(Field *field)
Definition: item.cc:465
TS-TODO: This should probably have Item_int_func as parent class.
Definition: item_timefunc.h:155
Item_func_to_seconds(const POS &pos, Item *a)
Definition: item_timefunc.h:107
Item_func_curdate_local(const POS &pos)
Definition: item_timefunc.h:1107
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:141
virtual bool get_time(MYSQL_TIME *res) override=0
Definition: table.h:1301
longlong val_int() override
Definition: item_timefunc.cc:1270
const char * func_name() const override
Definition: item_timefunc.h:394
virtual Time_zone * time_zone()=0
Item_int_func super
Definition: item_timefunc.h:288
Definition: my_time.h:389
Definition: item_timefunc.h:1389
enum Item_result result_type() const override
Definition: item_timefunc.h:178
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_timefunc.cc:1759
Item_time_literal(MYSQL_TIME *ltime, uint dec_arg)
Constructor for Item_time_literal.
Definition: item_timefunc.h:921
uint32 max_length
Maximum length of result of evaluating this item, in number of bytes.
Definition: item.h:2667
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:360
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1741
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:721
Definition: my_time.h:399
Definition: field_types.h:65
Time_zone * time_zone() override
Definition: item_timefunc.cc:1757
Item_func_now_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1194
Item_datetime_func()
Definition: item_timefunc.h:664
virtual bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override=0
Item_time_func super
Definition: item_timefunc.h:1000
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:3241
uint time_precision() override
TIME precision of the item: 0..6.
Definition: item_timefunc.h:538
String * val_str(String *str) override
Definition: item_timefunc.h:697
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1333
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_timefunc.cc:1404
Item_func_period_add(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:64
MY_LOCALE * locale
Definition: item_timefunc.h:191
Item_result result_type() const override
Definition: item_timefunc.h:575
const char * func_name() const override
Definition: item_timefunc.h:1617
Item_temporal_func(Item *a)
Definition: item_timefunc.h:518
Item_func_from_days(const POS &pos, Item *a)
Definition: item_timefunc.h:1227
String * val_str(String *str) override
Definition: item_timefunc.h:982
Definition: item_timefunc.h:220
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:1795
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.cc:860
bool has_date_args()
Definition: item_func.h:486
const char * func_name() const override
Definition: item_timefunc.h:1577
TIME&#39;10:10:10&#39;.
Definition: item_timefunc.h:912
Definition: item_timefunc.h:323
const bool is_date
Definition: item_timefunc.h:1475
#define DBUG_ASSERT(A)
Definition: my_dbug.h:197
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1504
longlong val_int() override
Definition: item_timefunc.cc:1003
Definition: my_time.h:398
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:203
Item_func_second(const POS &pos, Item *a)
Definition: item_timefunc.h:272
const char * func_name() const override
Definition: item_timefunc.h:67
Definition: item_timefunc.h:1499
Item_temporal_hybrid_func(Item *a, Item *b)
Definition: item_timefunc.h:570
interval_type
Available interval types used in any statement.
Definition: my_time.h:384
void set_numeric()
Definition: item.h:205
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_timefunc.h:929
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:974
Definition: item_timefunc.h:1464
Time_zone * time_zone() override
Definition: item_timefunc.cc:1733
String * val_str(String *str) override
Definition: item_timefunc.h:937
Item_date_func(const POS &pos)
Definition: item_timefunc.h:622
double val_real_from_decimal()
Definition: item.cc:411
Definition: item_timefunc.h:133
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:463
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1231
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.h:889
Definition: item_timefunc.h:86
String value
Definition: item_timefunc.h:1239
Item_func_year(const POS &pos, Item *a)
Definition: item_timefunc.h:325
Definition: item_func.h:167
virtual bool val_timeval(struct timeval *tm)=0
Return timestamp in "struct timeval" format.
Item_func_from_unixtime(const POS &pos, Item *a)
Definition: item_timefunc.h:1256
char * pos
Definition: do_ctype.cc:76
Item_typecast_time(Item *a)
Definition: item_timefunc.h:1408
Item_func_dayname(const POS &pos, Item *a)
Definition: item_timefunc.h:393
void set_data_type_date()
Set all type properties for Item of DATE type.
Definition: item.h:1169
Definition: item_func.h:199
Item_typecast_datetime(Item *a)
Definition: item_timefunc.h:1438
const char * func_name() const override
Definition: item_timefunc.h:1470
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1554
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:960
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:184
String * val_str(String *str) override
Definition: item_timefunc.cc:1291
Item_func_to_days(const POS &pos, Item *a)
Definition: item_timefunc.h:88
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:3162
const interval_type int_type
Definition: item_timefunc.h:1544
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:209
Bison "location" class.
Definition: parse_location.h:43
const char * func_name() const override
Definition: item_timefunc.h:109
Item_func_last_day(const POS &pos, Item *a)
Definition: item_timefunc.h:1603
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:988
static void store_in(Field *field)
Stores the query start time in a field, truncating to the field&#39;s number of fractional second digits...
Definition: item_timefunc.cc:1750
Definition: my_time.h:404
const char * func_name() const override
Definition: item_timefunc.h:1211
char string_buff[MAX_DATE_STRING_REP_LENGTH]
string representation
Definition: item_timefunc.h:771
const bool date_sub_interval
Definition: item_timefunc.h:1315
Item_func_internal_update_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1614
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.cc:1365
Definition: item_timefunc.h:1337
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:898
Struct representing a duration.
Definition: my_time.h:153
const char * cast_type() const
Definition: item_timefunc.h:1454
const char * cast_type() const
Definition: item_timefunc.h:1401
enum Functype functype() const override
Definition: item_timefunc.h:971
Definition: item_timefunc.h:1610
Definition: my_time.h:390
Field * tmp_table_field(TABLE *table) override
Definition: item_timefunc.h:587
Definition: item_timefunc.h:1567
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:899
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:2256
const char * func_name() const override
Definition: item_timefunc.h:640
longlong val_int() override
Definition: item_timefunc.cc:2805
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:2437
my_decimal class limits &#39;decimal_t&#39; type to what we need in MySQL.
Definition: my_decimal.h:91
Item_func_month(const POS &pos, Item *a)
Definition: item_timefunc.h:157
Item_date_add_interval(const POS &pos, Item *a, Item *b, interval_type type_arg, bool neg_arg)
Definition: item_timefunc.h:1316
longlong val_int() override
Definition: item_timefunc.cc:2346
Time_zone * to_tz
Definition: item_timefunc.h:1279
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:312
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:460
Functype
Definition: item_func.h:120
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:1768
const char * func_name() const override
Definition: item_timefunc.h:258
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:215
const interval_type int_type
Definition: item_timefunc.h:1341
enum Functype functype() const override
Definition: item_timefunc.h:1184
double
Definition: udf_registration_types.h:42
Definition: item_timefunc.h:1305
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:243
Definition: item_func.h:201
Field * tmp_table_field(TABLE *table) override
Definition: item_timefunc.h:535
Item_temporal_func(Item *a, Item *b, Item *c)
Definition: item_timefunc.h:523
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:147
const char * interval_names[]
Definition: item_timefunc.cc:2215
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:870
const char * func_name() const override
Definition: item_timefunc.h:1523
Item_date_func(const POS &pos, Item *a)
Definition: item_timefunc.h:626
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1533
Item_name_string orig_name
Original item name (if it was renamed)
Definition: item.h:2651
uint format_length(const String *format)
Definition: item_timefunc.cc:1855
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:336
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:430
String value
Definition: item_timefunc.h:1306
Item_date_func(Item *a)
Definition: item_timefunc.h:625
virtual bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override=0
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:810
Definition: item_timefunc.h:1622
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1083
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:1974
enum Item_result result_type() const override
Definition: item_timefunc.h:433
void set_time(MYSQL_TIME *ltime, uint8 dec_arg)
Set time and time_packed from a TIME value.
Definition: item_timefunc.cc:1623
Definition: item_func.h:206
Definition: item.h:668
unsigned int uint
Definition: uca-dump.cc:29
#define final(a, b, c)
Definition: hash.c:109
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:111
Item_func_period_diff(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:76
double val_real() override
Definition: item_timefunc.h:162
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.cc:874
void set(String &str, size_t offset, size_t arg_length)
Definition: sql_string.h:274
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1294
Item_func_now_local(uint8 dec_arg)
Definition: item_timefunc.h:1179
String * val_string_from_time(String *str)
Definition: item.cc:288
bool make_date_time(Date_time_format *format, MYSQL_TIME *l_time, enum_mysql_timestamp_type type, String *str)
Create a formated date/time value in a string.
Definition: item_timefunc.cc:505
Definition: field_types.h:87
bool null_value
True if item is null.
Definition: item.h:2732
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.h:751
long long int longlong
Definition: my_inttypes.h:54
bool get_date_from_time(MYSQL_TIME *ltime)
Convert get_time() from time to date in MYSQL_TIME.
Definition: item.cc:1224
Definition: item_timefunc.h:489
Item_func_now_local(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1180
Definition: item_strfunc.h:71
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.h:1084
enum Functype functype() const override
Definition: item_timefunc.h:1423
const CHARSET_INFO * collation
Definition: item.h:171
bool has_time_args()
Definition: item_func.h:497
int sign
Definition: item_timefunc.h:1476
enum Functype functype() const override
Definition: item_timefunc.h:1453
const char * func_name() const override
Definition: item_timefunc.h:1059
Item_datetime_func(const POS &pos, Item *a)
Definition: item_timefunc.h:673
Definition: item_timefunc.h:1474
Item_temporal_func(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:528
const char * func_name() const override
Definition: item_timefunc.h:1284
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:454
void cleanup() override
Definition: item_timefunc.cc:2058
Definition: item_timefunc.h:204
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:496
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:2511
String * val_str(String *) override
Definition: item_timefunc.h:1152
void cleanup() override
Definition: item_timefunc.h:991
Item_func_now(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1139
const char * func_name() const override
Definition: item_timefunc.h:176
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1695
enum Functype functype() const override
Definition: item_timefunc.h:641
Abstract CURTIME function. Children should define what time zone is used.
Definition: item_timefunc.h:999
Definition: item_func.h:203
const enum_mysql_timestamp_type type
Definition: item_timefunc.h:1572
String * val_str(String *str) override
Definition: item_timefunc.h:754
Item_datetime_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:683
Abstract class for functions returning TIME, DATE, DATETIME types whose data type is known at constru...
Definition: item_timefunc.h:510
static task_arg int_arg(int i)
Definition: task.h:165
Definition: item_func.h:848
const char * func_name() const override
Definition: item_timefunc.h:1597
Item_func_microsecond(const POS &pos, Item *a)
Definition: item_timefunc.h:1529
Definition: m_ctype.h:359
uint8_t uint8
Definition: my_inttypes.h:62
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1789
String * val_str(String *str) override
Definition: item_timefunc.h:166
enum Functype functype() const override
Definition: item_timefunc.h:298
TS-TODO: Item_func_dayname should be derived from Item_str_func.
Definition: item_timefunc.h:389
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3138
Definition: item_timefunc.h:1111
Item ** args
Definition: item_func.h:86
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1230
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:99
MYSQL_TIME_cache()
Definition: item_timefunc.h:784
String * val_str(String *str) override
Definition: item_timefunc.h:636
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:404
Definition: item_timefunc.h:1166
const char * func_name() const override
Definition: item_timefunc.h:1049
void set_data_type_decimal(uint8 precision, uint8 dec)
Set the data type of the Item to be decimal.
Definition: item.h:1047
Item_temporal_hybrid_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:572
Definition: field.h:584
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1234
Abstract class for functions returning TIME values.
Definition: item_timefunc.h:719
String * val_string_from_datetime(String *str)
Definition: item.cc:268
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:3091
Abstract CURRENT_TIMESTAMP function.
Definition: item_timefunc.h:1125
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.h:885
Definition: item_timefunc.h:438
table_map not_null_tables() const override
Definition: item_timefunc.h:901
Definition: item_timefunc.h:1564
Definition: item_timefunc.h:410
String * val_str_from_val_str_ascii(String *str, String *str2)
Definition: item_strfunc.cc:117
bool val_timeval(struct timeval *tm) override
Definition: item_timefunc.cc:1415
Definition: item_timefunc.h:1563
bool get_time_from_date(MYSQL_TIME *ltime)
Convert date to time.
Definition: item.cc:1312
Definition: my_time.h:394
Time_zone * time_zone() override
Definition: item_timefunc.cc:1705
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:276
THD * thd
Definition: item_timefunc.h:1623
longlong val_int_from_time()
Definition: item.cc:429
Item_temporal_func(const POS &pos, Item *a)
Definition: item_timefunc.h:519
Item_time_func(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:736
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:1608
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:82
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:931
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:146
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:299
Definition: item_timefunc.h:190
Item_func_quarter(const POS &pos, Item *a)
Definition: item_timefunc.h:256
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:939
table_map used_tables() const override
Definition: item_timefunc.h:944
Time_zone * from_tz
Definition: item_timefunc.h:1279
const CHARSET_INFO * charset_for_protocol() const override
Definition: item_timefunc.h:532
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:942
Item_time_func(const POS &pos, Item *a)
Definition: item_timefunc.h:733
Item_timeval_func(const POS &pos, Item *a)
Definition: item_timefunc.h:415
void set_data_type(enum_field_types data_type)
Set the data type of the current Item.
Definition: item.h:1019
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_timefunc.cc:915
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:214
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:476
bool get_time(MYSQL_TIME *ltime) override
Definition: item_timefunc.h:1024
const char * func_name() const override
Definition: item_timefunc.h:208
enum Functype functype() const override
Definition: item_timefunc.h:371
double val_real() override
Definition: item_timefunc.h:591
Item_timeval_func(const POS &pos)
Definition: item_timefunc.h:412
const char * func_name() const override
Definition: item_timefunc.h:1329
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:264
Definition: mysql_time.h:64
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:2202
Item_func_curdate(const POS &pos)
Definition: item_timefunc.h:1075
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:957
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override
Definition: item_timefunc.cc:1010
const char * func_name() const override
Definition: item_timefunc.h:1183
bool maybe_null
True if this item may be null.
Definition: item.h:2731
String * val_str(String *str) override
Definition: item_timefunc.cc:1925
enum_mysql_timestamp_type
Definition: mysql_time.h:44
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1351
uint datetime_precision() override
DATETIME precision of the item: 0..6.
Definition: item_timefunc.h:542
Definition: my_time.h:395
SYSDATE() is like NOW(), but always uses the real current time, not the query_start().
Definition: item_timefunc.h:1206
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1716
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:2063
const char * func_name() const override
Definition: item_timefunc.h:139
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:92
String * val_str_ascii(String *str) override
Return string value in ASCII character set.
Definition: item_timefunc.cc:885
Item_func_hour(const POS &pos, Item *a)
Definition: item_timefunc.h:222
Item_func_weekday(const POS &pos, Item *a, bool type_arg)
Definition: item_timefunc.h:349
enum Type type() const override
Definition: item_func.h:226
int type
Definition: http_common.h:411
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2247
virtual uint datetime_precision()
DATETIME precision of the item: 0..6.
Definition: item.cc:641
Item_typecast_datetime(const POS &pos, Item *a, uint8 dec_arg)
Definition: item_timefunc.h:1445
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:1156
Definition: item_timefunc.h:1225
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:2649
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name with argument list or fractional seconds part to the String str...
Definition: item_timefunc.cc:953
const char * func_name() const override
Definition: item_timefunc.h:1299
Definition: item_func.h:204
Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:524
Item_func_add_time(const POS &pos, Item *a, Item *b, bool type_arg, bool neg_arg)
Definition: item_timefunc.h:1484
const char * func_name() const override
Definition: item_timefunc.h:1117
const char * func_name() const override
Definition: item_timefunc.h:90
bool get_date(MYSQL_TIME *res, my_time_flags_t) override
Definition: item_timefunc.h:1148
Definition: item_func.h:208
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:1838
Representation of time formats.
Definition: sql_time.h:59
Definition: item_timefunc.h:254
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:495
Item_func_curdate_utc(const POS &pos)
Definition: item_timefunc.h:1116
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1538
MYSQL_TIME_cache cached_time
Definition: item_timefunc.h:913
table_map get_initial_pseudo_tables() const override
This function is non-deterministic and hence depends on the &#39;RAND&#39; pseudo-table.
Definition: item_timefunc.h:1220
longlong val_int_from_decimal()
Definition: item.cc:420
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:282
longlong val_int() override
Definition: item_timefunc.cc:1033
MYSQL_TIME * get_TIME_ptr()
Return pointer to MYSQL_TIME representation.
Definition: item_timefunc.h:852
virtual Time_zone * time_zone()=0
const char * func_name() const override
Definition: item_timefunc.h:1606
longlong val_int() override
Returns the quarter of the year.
Definition: item_timefunc.cc:1176
bool get_date_internal(MYSQL_TIME *res, my_time_flags_t fuzzy_date)
Definition: item_timefunc.cc:2108
String * val_string_from_date(String *str)
Definition: item.cc:278
Definition: my_time.h:397
Definition: my_time.h:393
Item_func_curtime_utc(const POS &pos, uint8 dec_arg)
Definition: item_timefunc.h:1057
longlong val_int() override
MICROSECOND(a) is a function ( extraction) that extracts the microseconds from a. ...
Definition: item_timefunc.cc:2799
Item_func_internal_check_time(const POS &pos, PT_item_list *list)
Definition: item_timefunc.h:1626
Definition: item_timefunc.h:1527
double val_real() override
Definition: item_timefunc.h:355
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:1092
const char * func_name() const override
Definition: item_timefunc.h:1550
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:659
Definition: field_types.h:69
longlong val_int() override
Definition: item_timefunc.h:590
bool fixed
True if item has been resolved.
Definition: item.h:2711
bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Get "native" temporal value as MYSQL_TIME.
Definition: item_timefunc.cc:2195
Definition: item_func.h:202
const char * cptr() const
Return C string representation.
Definition: item_timefunc.h:863
longlong val_int() override
Definition: item_timefunc.cc:974
Item_func_curtime(const POS &pos, uint8 dec_arg)
Constructor for Item_func_curtime.
Definition: item_timefunc.h:1013
Definition: item_func.h:198
Time declarations shared between the server and client API: you should not add anything to this heade...
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:3249
#define MY_MIN(a, b)
Definition: my_macros.h:62
Definition: item_func.h:161
bool has_datetime_args()
Definition: item_func.h:508
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:745
ulonglong sql_mode_t
Definition: dd_event.h:36
longlong val_int() override
Definition: item_timefunc.h:700
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:482
double val_real() override
Definition: item_timefunc.cc:1388
const char * func_name() const override
Definition: item_timefunc.h:1452
longlong val_int() override
Definition: item_timefunc.cc:1252
Definition: my_time.h:385
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:3059
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1578
Item_temporal_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_timefunc.h:526
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:1352
const char * func_name() const override
Definition: item_timefunc.h:1246
Definition: item_func.h:210
Item_typecast_time(const POS &pos, Item *a)
Definition: item_timefunc.h:1411
const char * func_name() const override
Definition: item_timefunc.h:1398
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1426
const char * func_name() const override
Definition: item_timefunc.h:1629
String str_value
str_values&#39;s main purpose is to cache the value in save_in_field
Definition: item.h:2642
const char * func_name() const override
Definition: item_timefunc.h:274
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Converts current time in my_time_t to MYSQL_TIME represenatation for local time zone.
Definition: item_timefunc.cc:1777
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:248
longlong val_int() override
Definition: item_timefunc.cc:1183
Definition: item_timefunc.h:62
const char * func_name() const override
Definition: item_timefunc.h:1199
bool to_tz_cached
Definition: item_timefunc.h:1278
Item_time_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:740
bool intro_version(uchar *int_arg) override
Definition: item_timefunc.h:119
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1812
A better implementation of the UNIX ctype(3) library.
Item_datetime_literal(MYSQL_TIME *ltime, uint dec_arg)
Constructor for Item_datetime_literal.
Definition: item_timefunc.h:965
Item_timeval_func super
Definition: item_timefunc.h:439
Item_extract(const POS &pos, interval_type type_arg, Item *a)
Definition: item_timefunc.h:1342
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:510
String * val_str(String *str) override
Return string value in @character_set_connection.
Definition: item_timefunc.h:600
bool get_time_from_datetime(MYSQL_TIME *ltime)
Convert datetime to time.
Definition: item.cc:1320
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:373
void set_data_type_time(uint8 fsp)
Set all type properties for Item of TIME type.
Definition: item.h:1181
double val_real() override
Definition: item_timefunc.h:639
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:1147
longlong val_int() override
Definition: item_timefunc.h:637
Item_func_unix_timestamp(Item *a)
Definition: item_timefunc.h:444
Definition: my_time.h:403
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.cc:2016
Abstract class for functions returning DATETIME values.
Definition: item_timefunc.h:657
Definition: item_timefunc.h:1565
enum Functype functype() const override
Definition: item_timefunc.h:1532
bool odbc_type
Definition: item_timefunc.h:346
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:1674
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:2424
void set_datetime(MYSQL_TIME *ltime, uint8 dec_arg)
Set time and time_packed from a DATETIME value.
Definition: item_timefunc.cc:1639
Interface for low level time utilities.
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_timefunc.cc:945
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:702
Item_typecast_date(Item *a)
Definition: item_timefunc.h:1391
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_timefunc.cc:1709
bool check_precision()
Definition: item_timefunc.cc:790
Item_func_timediff(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1501
enum Item_result result_type() const override
Definition: item_timefunc.h:372
Definition: item_timefunc.h:1290
Item_date_add_interval(Item *a, Item *b, interval_type type_arg, bool neg_arg)
POS-less ctor for post-parse construction with implicit addition to THD&#39;s free_list (see Item::Item()...
Definition: item_timefunc.h:1325
interval_type intervaltype() const
Definition: item_timefunc.h:1552
Item_func_now super
Definition: item_timefunc.h:1188
longlong val_int() override
Definition: item_timefunc.cc:1127
enum Functype functype() const override
Definition: item_timefunc.h:140
Definition: item_timefunc.h:1601
const char * func_name() const override
Definition: item_timefunc.h:882
table_map not_null_tables() const override
Definition: item_timefunc.h:990
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:396
const char * func_name() const override
Definition: item_timefunc.h:1496
bool get_time_internal(MYSQL_TIME *res)
Definition: item_timefunc.cc:2143
bool is_set() const
Check if m_ptr is set.
Definition: sql_string.h:105
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:500
uint8 dec
Number of decimals.
Definition: item_timefunc.h:773
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.h:978
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2022
Item_func_dayofyear(const POS &pos, Item *a)
Definition: item_timefunc.h:206
enum Functype functype() const override
Definition: item_timefunc.h:91
Definition: item_timefunc.h:1187
MY_LOCALE * locale
Definition: item_timefunc.h:390
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2972
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:1537
String * val_str(String *str) override
Definition: item_timefunc.cc:1157
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:378
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:99
TS-TODO: This should probably have Item_int_func as parent class.
Definition: item_timefunc.h:345
Item_func_week(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:292
enum Functype functype() const override
Definition: item_timefunc.h:242
Definition: sql_locale.h:36
String ascii_buf
Definition: item_timefunc.h:557
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:427
const char * func_name() const override
Definition: item_timefunc.h:297
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_timefunc.cc:1688
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1327
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:1032
enum Functype functype() const override
Definition: item_timefunc.h:1551
Definition: my_time.h:392
Definition: item_timefunc.h:1042
enum Functype functype() const override
Definition: item_timefunc.h:1330
bool check_valid_arguments_processor(uchar *) override
Definition: item_timefunc.h:100
constexpr const int DATETIME_MAX_DECIMALS
Definition: my_time.h:131
Item_datetime_func(Item *a)
Definition: item_timefunc.h:670
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:3009
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.cc:839
Definition: item_func.h:166
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_timefunc.h:198
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1034
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_timefunc.cc:2901
Definition: item_func.h:207
Definition: item_timefunc.h:270
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:1519
type_conversion_status save_date_in_field(Field *field)
Definition: item.cc:472
Time_zone * time_zone() override
Definition: item_timefunc.cc:1737
Item_func_yearweek(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:308
#define false
Definition: config_static.h:43
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:226
Abstract class for functions returning DATE values.
Definition: item_timefunc.h:614
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
longlong val_packed() const
Return packed representation.
Definition: item_timefunc.h:833
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_timefunc.h:643
enum Functype functype() const override
Definition: item_timefunc.h:1345
Item_func_add_time(const POS &pos, Item *a, Item *b)
Definition: item_timefunc.h:1490
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1302
Definition: item_func.h:174
longlong val_int_from_datetime()
Definition: item.cc:451
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:179
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1187
const char * func_name() const override
Definition: item_timefunc.h:79
Definition: item_strfunc.h:156
Definition: item_func.h:209
Item_typecast_datetime(const POS &pos, Item *a)
Definition: item_timefunc.h:1441
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:616
#define MY_INT64_NUM_DECIMAL_DIGITS
Definition: my_inttypes.h:120
bool get_date(MYSQL_TIME *res, my_time_flags_t fuzzy_date) override
Definition: item_timefunc.cc:2447
longlong val_int() override
Definition: item_timefunc.cc:1135
Definition: field.h:582
Cache for MYSQL_TIME value with various representations.
Definition: item_timefunc.h:768
Item_temporal_func()
Definition: item_timefunc.h:515
Definition: item_timefunc.h:1570
Item_func_maketime(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_timefunc.h:1515
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
bool eq(const MYSQL_TIME_cache &tm) const
Test if cached value is equal to another MYSQL_TIME_cache value.
Definition: item_timefunc.h:818
bool has_timestamp_args()
Definition: item_func.h:476
Time_zone * time_zone() override
Definition: item_timefunc.cc:1766
longlong val_int() override
Definition: item_timefunc.cc:1442
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:110
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_timefunc.h:364
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:778
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:2730
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:2577
Item_typecast_date(const POS &pos, Item *a)
Definition: item_timefunc.h:1392
longlong val_int() override
Definition: item_timefunc.cc:1189
Definition: my_time.h:386
enum Item_result result_type() const override
Definition: item_timefunc.h:402
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_timefunc.h:642
longlong val_int() override
Definition: item_timefunc.h:749
enum Functype functype() const override
Definition: item_timefunc.h:328
Field * tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
Create a field based on field_type of argument.
Definition: item.cc:5730
virtual bool val_datetime(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date)=0
Get "native" temporal value as MYSQL_TIME.
uint string_length
length of string
Definition: item_timefunc.h:772
enum_monotonicity_info get_monotonicity_info() const override
Definition: item_timefunc.cc:1426
void cleanup() override
Definition: item_timefunc.h:902
#define MY_MAX(a, b)
Definition: my_macros.h:61