summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2018-08-06 13:37:09 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2018-08-06 13:37:09 +0400
commit4ddcb4eb46c62cf459936554d43351db740ba14d (patch)
treeeecf78915019b1edae829eaa2a4587d6dd2bf037 /sql/item_jsonfunc.cc
parentfc324a5f87827e43f51d1a75e60b3d5abcd807e5 (diff)
downloadmariadb-git-4ddcb4eb46c62cf459936554d43351db740ba14d.tar.gz
MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
The charset of temporary storage (Item_func_json_insert::tmp_js) was not properly set.
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index e9d38b78843..4a837646451 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -2384,8 +2384,9 @@ String *Item_func_json_insert::val_str(String *str)
if ((null_value= args[0]->null_value))
return 0;
- str->set_charset(js->charset());
- json_string_set_cs(&key_name, js->charset());
+ str->set_charset(collation.collation);
+ tmp_js.set_charset(collation.collation);
+ json_string_set_cs(&key_name, collation.collation);
for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++)
{
@@ -2599,7 +2600,6 @@ continue_point:
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
str->length(0);
- str->set_charset(js->charset());
if (json_nice(&je, str, Item_func_json_format::LOOSE))
goto js_error;