diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-03-28 11:26:02 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-03-28 11:26:02 +0400 |
commit | c34602995894c9a04f4312484cfe6e45c43426e6 (patch) | |
tree | 16d5e90168fdbede15163b60610616c2e036bcd1 /sql/item_timefunc.cc | |
parent | 068450a3828a7ed678081fb57f63950d0828c430 (diff) | |
download | mariadb-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.cc | 7 |
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 { |