1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-9143 JSON_xxx functions.

The rest of mysql/json functions implemented.
        CAST AS JSON implemented.
This commit is contained in:
Alexey Botchkov
2016-11-15 17:04:31 +04:00
parent 1122c1f0c2
commit ebe5ebba16
15 changed files with 1619 additions and 59 deletions

View File

@ -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;
}