summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-12-27 18:20:28 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-12-27 18:20:28 +0200
commit4c25e75ce766440694553e0baf03cc5c6e803fc3 (patch)
treef75cea6e472054b7a15466ea5e31c862ae9e77cc /sql/item_timefunc.h
parent4c57ab34d4852387da4ef8eac862045d1458de1e (diff)
parent808bc919eb94ac888f2014275b443ebdaf733ae5 (diff)
downloadmariadb-git-4c25e75ce766440694553e0baf03cc5c6e803fc3.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index fe9dc8b43e2..8a69a0a3d5a 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -422,20 +422,13 @@ public:
};
-class Item_func_weekday :public Item_func
+class Item_func_weekday :public Item_long_func
{
bool odbc_type;
public:
Item_func_weekday(THD *thd, Item *a, bool type_arg):
- Item_func(thd, a), odbc_type(type_arg) { collation.set_numeric(); }
+ Item_long_func(thd, a), odbc_type(type_arg) { }
longlong val_int();
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
- String *val_str(String *str)
- {
- DBUG_ASSERT(fixed == 1);
- str->set(val_int(), &my_charset_bin);
- return null_value ? 0 : str;
- }
const char *func_name() const
{
return (odbc_type ? "dayofweek" : "weekday");
@@ -444,7 +437,6 @@ public:
{
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
}
- const Type_handler *type_handler() const { return &type_handler_long; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -462,11 +454,11 @@ public:
{ return get_item_copy<Item_func_weekday>(thd, this); }
};
-class Item_func_dayname :public Item_func_weekday
+class Item_func_dayname :public Item_str_func
{
MY_LOCALE *locale;
public:
- Item_func_dayname(THD *thd, Item *a): Item_func_weekday(thd, a, 0) {}
+ Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {}
const char *func_name() const { return "dayname"; }
String *val_str(String *str);
const Type_handler *type_handler() const { return &type_handler_varchar; }
@@ -476,6 +468,12 @@ class Item_func_dayname :public Item_func_weekday
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
+ bool check_valid_arguments_processor(void *int_arg)
+ {
+ return !has_date_args();
+ }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dayname>(thd, this); }
};