summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-03-28 11:26:02 +0400
committerAlexander Barkov <bar@mariadb.com>2018-03-28 11:26:02 +0400
commitc34602995894c9a04f4312484cfe6e45c43426e6 (patch)
tree16d5e90168fdbede15163b60610616c2e036bcd1 /sql/item_timefunc.cc
parent068450a3828a7ed678081fb57f63950d0828c430 (diff)
downloadmariadb-git-c34602995894c9a04f4312484cfe6e45c43426e6.tar.gz
MDEV-15702 Remove the use of STRING_ITEM from Item_func_date_format::fix_length_and_dec()
Implementing the task according to the description. Additionally, implementing Item_func_date_format::check_arguments().
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 4ddeb83b163..f612b4d6aa2 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1859,11 +1859,12 @@ void Item_func_date_format::fix_length_and_dec()
if (!thd->variables.lc_time_names->is_ascii)
repertoire|= MY_REPERTOIRE_EXTENDED;
collation.set(cs, arg1->collation.derivation, repertoire);
- if (arg1->type() == STRING_ITEM)
+ StringBuffer<STRING_BUFFER_USUAL_SIZE> buffer;
+ String *str;
+ if (args[1]->basic_const_item() && (str= args[1]->val_str(&buffer)))
{ // Optimize the normal case
fixed_length=1;
- max_length= format_length(arg1->val_str(NULL)) *
- collation.collation->mbmaxlen;
+ max_length= format_length(str) * collation.collation->mbmaxlen;
}
else
{