summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-11-15 17:04:31 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-11-15 17:04:31 +0400
commitebe5ebba165863a134c145b1a3709b70925d5100 (patch)
tree049feb2aea5d44134eabb9b451b03d26bad1b707 /strings
parent1122c1f0c219a01cdbe5c760b2a846bba80b5949 (diff)
downloadmariadb-git-ebe5ebba165863a134c145b1a3709b70925d5100.tar.gz
MDEV-9143 JSON_xxx functions.
The rest of mysql/json functions implemented. CAST AS JSON implemented.
Diffstat (limited to 'strings')
-rw-r--r--strings/json_lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 3f55280e3fa..662207c3899 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1174,7 +1174,7 @@ static int handle_match(json_engine_t *je, json_path_t *p,
Check if the name of the current JSON key matches
the step of the path.
*/
-static int json_key_matches(json_engine_t *je, json_string_t *k)
+int json_key_matches(json_engine_t *je, json_string_t *k)
{
while (json_read_keyname_chr(je) == 0)
{
@@ -1409,6 +1409,8 @@ int json_unescape(CHARSET_INFO *json_cs,
CHARSET_INFO *res_cs, uchar *res, uchar *res_end)
{
json_string_t s;
+ const uchar *res_b= res;
+
json_string_setup(&s, json_cs, json_str, json_end);
while (json_read_string_const_chr(&s) == 0)
{
@@ -1434,7 +1436,7 @@ int json_unescape(CHARSET_INFO *json_cs,
return -1;
}
- return s.error ? 1 : 0;
+ return s.error==JE_EOS ? res - res_b : -1;
}