summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-22 20:22:55 +0200
committerSergei Golubchik <serg@mariadb.org>2017-09-23 20:22:46 +0200
commit80b9ce359312c1520623531bf173ee048317fee3 (patch)
tree2b6ae2fbaa78af922e9182bb6e5484b6e0c24da3 /sql/item_timefunc.h
parent1320ad5b9253256afe98e948d25ed0a423a1e6da (diff)
downloadmariadb-git-80b9ce359312c1520623531bf173ee048317fee3.tar.gz
MDEV-11553 Can't restore a PERSISTENT column that uses DATE_FORMAT()
3-argument form of DATE_FORMAT
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 7d2fe46b644..20ecb4774b3 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -797,22 +797,24 @@ public:
class Item_func_date_format :public Item_str_func
{
- MY_LOCALE *locale;
+ const MY_LOCALE *locale;
int fixed_length;
- const bool is_time_format;
String value;
+protected:
+ bool is_time_format;
public:
- Item_func_date_format(THD *thd, Item *a, Item *b, bool is_time_format_arg):
- Item_str_func(thd, a, b), is_time_format(is_time_format_arg) {}
+ Item_func_date_format(THD *thd, Item *a, Item *b):
+ Item_str_func(thd, a, b), locale(0), is_time_format(false) {}
+ Item_func_date_format(THD *thd, Item *a, Item *b, Item *c):
+ Item_str_func(thd, a, b, c), locale(0), is_time_format(false) {}
String *val_str(String *str);
- const char *func_name() const
- { return is_time_format ? "time_format" : "date_format"; }
+ const char *func_name() const { return "date_format"; }
void fix_length_and_dec();
uint format_length(const String *format);
bool eq(const Item *item, bool binary_cmp) const;
bool check_vcol_func_processor(void *arg)
{
- if (is_time_format)
+ if (arg_count > 2)
return false;
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
@@ -820,6 +822,17 @@ public:
{ return get_item_copy<Item_func_date_format>(thd, mem_root, this); }
};
+class Item_func_time_format: public Item_func_date_format
+{
+public:
+ Item_func_time_format(THD *thd, Item *a, Item *b):
+ Item_func_date_format(thd, a, b) { is_time_format= true; }
+ const char *func_name() const { return "time_format"; }
+ bool check_vcol_func_processor(void *arg) { return false; }
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_time_format>(thd, mem_root, this); }
+};
+
class Item_func_from_unixtime :public Item_datetimefunc
{