summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-11-20 11:12:08 +0400
committerAlexander Barkov <bar@mariadb.org>2017-11-20 11:12:08 +0400
commit4a8039b04e60b599b90e1c58021026697272c324 (patch)
treeb8f3d634a95f90b7a496aa3781fb3d9577294964 /sql/item_jsonfunc.cc
parenta0c7d3ff940600aa2d7cff067396ef6985f0bdc4 (diff)
parenta20c1217a5ce4235f72c59935a03b56fead2f6c4 (diff)
downloadmariadb-git-4a8039b04e60b599b90e1c58021026697272c324.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index ddc1da5b6d2..38d6e4feba0 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -69,6 +69,7 @@ static inline bool append_simple(String *s, const uchar *a, size_t a_len)
/*
Appends JSON string to the String object taking charsets in
consideration.
+*/
static int st_append_json(String *s,
CHARSET_INFO *json_cs, const uchar *js, uint js_len)
{
@@ -82,9 +83,8 @@ static int st_append_json(String *s,
return 0;
}
- return js_len;
+ return str_len;
}
-*/
/*
@@ -475,6 +475,9 @@ String *Item_func_json_value::val_str(String *str)
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
+ str->length(0);
+ str->set_charset(&my_charset_utf8mb4_bin);
+
path.cur_step= path.p.steps;
continue_search:
if (json_find_path(&je, &path.p, &path.cur_step, array_counters))
@@ -515,8 +518,7 @@ bool Item_func_json_value::check_and_get_value(json_engine_t *je, String *res,
return true;
}
- res->set((const char *) je->value, je->value_len, je->s.cs);
- return false;
+ return st_append_json(res, je->s.cs, je->value, je->value_len);
}