summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-09-05 13:09:40 +0200
committerSergei Golubchik <serg@mariadb.org>2021-10-12 13:28:10 +0200
commit8150f52e4769cd3b894549656933987c1ef8af2d (patch)
treeb5bc02460ab8966d65e351a058eecf367c4fac9c /sql/item_strfunc.cc
parentfe65ca0176e126f0b33bfcfdaab1154c0bfabe42 (diff)
downloadmariadb-git-8150f52e4769cd3b894549656933987c1ef8af2d.tar.gz
support charsets with mbminlen > 1
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c9736b5e602..fd5e2609e0c 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1311,7 +1311,20 @@ bool Item_func_sformat::fix_length_and_dec()
{
ulonglong char_length= 0;
- if (agg_arg_charsets_for_string_result(collation, args, arg_count))
+ uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
+ MY_COLL_ALLOW_COERCIBLE_CONV |
+ MY_COLL_ALLOW_NUMERIC_CONV;
+
+ if (Type_std_attributes::agg_item_collations(collation, func_name_cstring(),
+ args, arg_count, flags, 1))
+ return TRUE;
+
+ DTCollation c= collation;
+ if (c.collation->mbminlen > 1)
+ c.collation= &my_charset_utf8mb4_bin;
+
+ if (Type_std_attributes::agg_item_set_converter(c, func_name_cstring(), args,
+ arg_count, flags, 1))
return TRUE;
for (uint i=0 ; i < arg_count ; i++)
@@ -1406,7 +1419,7 @@ String *Item_func_sformat::val_str(String *res)
fmt::format_args(vargs, arg_count-1));
res->length(0);
res->set_charset(collation.collation);
- res->append(text.c_str(), text.size());
+ res->append(text.c_str(), text.size(), fmt_arg->charset());
}
catch (const fmt::format_error &ex)
{