mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-17121 JSON_ARRAY_APPEND.
Extra comma added to the result when an json array is empty.
This commit is contained in:
@ -1621,13 +1621,15 @@ String *Item_func_json_array_append::val_str(String *str)
|
||||
|
||||
if (je.value_type == JSON_VALUE_ARRAY)
|
||||
{
|
||||
if (json_skip_level(&je))
|
||||
int n_items;
|
||||
if (json_skip_level_and_count(&je, &n_items))
|
||||
goto js_error;
|
||||
|
||||
ar_end= je.s.c_str - je.sav_c_len;
|
||||
str_rest_len= js->length() - (ar_end - (const uchar *) js->ptr());
|
||||
str->q_append(js->ptr(), ar_end-(const uchar *) js->ptr());
|
||||
str->append(", ", 2);
|
||||
if (n_items)
|
||||
str->append(", ", 2);
|
||||
if (append_json_value(str, args[n_arg+1], &tmp_val))
|
||||
goto return_null; /* Out of memory. */
|
||||
|
||||
|
Reference in New Issue
Block a user