diff options
author | Galina Shalygina <galashalygina@gmail.com> | 2016-05-01 22:29:47 +0300 |
---|---|---|
committer | Galina Shalygina <galashalygina@gmail.com> | 2016-08-23 00:39:12 +0300 |
commit | eb2c1474752a5f743db638d5b06612c9e3f07f74 (patch) | |
tree | 2cbdafbe8617bf72f8addf3cfcdd53b10c7cbe8e /sql/item_timefunc.h | |
parent | 8b94aec11af19fc711ed48f13410986814bc51a0 (diff) | |
download | mariadb-git-eb2c1474752a5f743db638d5b06612c9e3f07f74.tar.gz |
The consolidated patch for mdev-9197.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r-- | sql/item_timefunc.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 175f3b06c1a..0edfc4f6a82 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -53,6 +53,8 @@ public: { max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_period_add>(thd, mem_root, this); } }; @@ -67,6 +69,8 @@ public: decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_period_diff>(thd, mem_root, this); } }; @@ -90,6 +94,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_to_days>(thd, mem_root, this); } }; @@ -123,6 +129,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_to_seconds>(thd, mem_root, this); } }; @@ -144,6 +152,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_dayofmonth>(thd, mem_root, this); } }; @@ -178,6 +188,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_month>(thd, mem_root, this); } }; @@ -195,6 +207,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_monthname>(thd, mem_root, this); } }; @@ -216,6 +230,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_dayofyear>(thd, mem_root, this); } }; @@ -237,6 +253,8 @@ public: { return !has_time_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_hour>(thd, mem_root, this); } }; @@ -258,6 +276,8 @@ public: { return !has_time_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_minute>(thd, mem_root, this); } }; @@ -279,6 +299,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_quarter>(thd, mem_root, this); } }; @@ -300,6 +322,8 @@ public: { return !has_time_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_second>(thd, mem_root, this); } }; @@ -315,6 +339,8 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_week>(thd, mem_root, this); } }; class Item_func_yearweek :public Item_int_func @@ -335,6 +361,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_yearweek>(thd, mem_root, this); } }; @@ -358,6 +386,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_year>(thd, mem_root, this); } }; @@ -393,6 +423,8 @@ public: { return !has_date_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_weekday>(thd, mem_root, this); } }; class Item_func_dayname :public Item_func_weekday @@ -464,6 +496,8 @@ public: } longlong int_op(); my_decimal *decimal_op(my_decimal* buf); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_unix_timestamp>(thd, mem_root, this); } }; @@ -483,6 +517,8 @@ public: } longlong int_op(); my_decimal *decimal_op(my_decimal* buf); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_time_to_sec>(thd, mem_root, this); } }; @@ -625,6 +661,8 @@ public: Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {} const char *func_name() const { return "curtime"; } virtual void store_now_in_TIME(MYSQL_TIME *now_time); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_curtime_local>(thd, mem_root, this); } }; @@ -634,6 +672,8 @@ public: Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {} const char *func_name() const { return "utc_time"; } virtual void store_now_in_TIME(MYSQL_TIME *now_time); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_curtime_utc>(thd, mem_root, this); } }; @@ -660,6 +700,8 @@ public: Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {} const char *func_name() const { return "curdate"; } void store_now_in_TIME(MYSQL_TIME *now_time); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_curdate_local>(thd, mem_root, this); } }; @@ -669,6 +711,8 @@ public: Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {} const char *func_name() const { return "utc_date"; } void store_now_in_TIME(MYSQL_TIME *now_time); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_curdate_utc>(thd, mem_root, this); } }; @@ -703,6 +747,8 @@ public: const char *func_name() const { return "now"; } virtual void store_now_in_TIME(MYSQL_TIME *now_time); virtual enum Functype functype() const { return NOW_FUNC; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_now_local>(thd, mem_root, this); } }; @@ -712,6 +758,8 @@ public: Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {} const char *func_name() const { return "utc_timestamp"; } virtual void store_now_in_TIME(MYSQL_TIME *now_time); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_now_utc>(thd, mem_root, this); } }; @@ -733,6 +781,8 @@ public: maybe_null= 0; used_tables_cache|= RAND_TABLE_BIT; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_sysdate_local>(thd, mem_root, this); } }; @@ -748,6 +798,8 @@ public: { return has_date_args() || has_time_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_from_days>(thd, mem_root, this); } }; @@ -766,6 +818,8 @@ public: void fix_length_and_dec(); uint format_length(const String *format); bool eq(const Item *item, bool binary_cmp) const; + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_date_format>(thd, mem_root, this); } }; @@ -777,6 +831,8 @@ class Item_func_from_unixtime :public Item_datetimefunc const char *func_name() const { return "from_unixtime"; } void fix_length_and_dec(); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_from_unixtime>(thd, mem_root, this); } }; @@ -811,6 +867,8 @@ class Item_func_convert_tz :public Item_datetimefunc void fix_length_and_dec(); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); void cleanup(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_convert_tz>(thd, mem_root, this); } }; @@ -825,6 +883,8 @@ public: Item_timefunc::fix_length_and_dec(); } const char *func_name() const { return "sec_to_time"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_sec_to_time>(thd, mem_root, this); } }; @@ -842,6 +902,8 @@ public: bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool eq(const Item *item, bool binary_cmp) const; void print(String *str, enum_query_type query_type); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_date_add_interval>(thd, mem_root, this); } }; @@ -896,6 +958,8 @@ class Item_extract :public Item_int_func } return true; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_extract>(thd, mem_root, this); } }; @@ -919,6 +983,8 @@ public: String *val_str(String *a); void fix_length_and_dec(); void print(String *str, enum_query_type query_type); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_char_typecast>(thd, mem_root, this); } }; @@ -944,6 +1010,8 @@ public: bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); const char *cast_type() const { return "date"; } enum_field_types field_type() const { return MYSQL_TYPE_DATE; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_date_typecast>(thd, mem_root, this); } }; @@ -956,6 +1024,8 @@ public: bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); const char *cast_type() const { return "time"; } enum_field_types field_type() const { return MYSQL_TYPE_TIME; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_time_typecast>(thd, mem_root, this); } }; @@ -968,6 +1038,8 @@ public: const char *cast_type() const { return "datetime"; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_datetime_typecast>(thd, mem_root, this); } }; @@ -979,6 +1051,8 @@ public: const char *func_name() const { return "makedate"; } enum_field_types field_type() const { return MYSQL_TYPE_DATE; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_makedate>(thd, mem_root, this); } }; @@ -995,6 +1069,8 @@ public: bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); void print(String *str, enum_query_type query_type); const char *func_name() const { return "add_time"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_add_time>(thd, mem_root, this); } }; class Item_func_timediff :public Item_timefunc @@ -1009,6 +1085,8 @@ public: Item_timefunc::fix_length_and_dec(); } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_timediff>(thd, mem_root, this); } }; class Item_func_maketime :public Item_timefunc @@ -1024,6 +1102,8 @@ public: } const char *func_name() const { return "maketime"; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_maketime>(thd, mem_root, this); } }; @@ -1044,6 +1124,8 @@ public: { return !has_time_args(); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_microsecond>(thd, mem_root, this); } }; @@ -1061,6 +1143,8 @@ public: maybe_null=1; } virtual void print(String *str, enum_query_type query_type); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_timestamp_diff>(thd, mem_root, this); } }; @@ -1085,6 +1169,8 @@ public: fix_length_and_charset(17, default_charset()); } virtual void print(String *str, enum_query_type query_type); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_get_format>(thd, mem_root, this); } }; @@ -1103,6 +1189,8 @@ public: bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); const char *func_name() const { return "str_to_date"; } void fix_length_and_dec(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_str_to_date>(thd, mem_root, this); } }; @@ -1112,6 +1200,8 @@ public: Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {} const char *func_name() const { return "last_day"; } bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy<Item_func_last_day>(thd, mem_root, this); } }; #endif /* ITEM_TIMEFUNC_INCLUDED */ |