summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-08-24 10:22:37 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-08-24 10:22:37 +0300
commit2bddc5d045b40e64fd2e08cf8e3666370c69ff2b (patch)
treeb57b9ebe21d3f88a113703cd0b4988c24a89feea /sql/item_jsonfunc.cc
parent445234942abfaeff3cc8f791f7757a2f9edbb246 (diff)
parentbdd80e3fb1cb653c367099639bec46840eca86e1 (diff)
downloadmariadb-git-2bddc5d045b40e64fd2e08cf8e3666370c69ff2b.tar.gz
Merge 10.7 into 10.8
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 0a18e9c9192..1c80bb46a91 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, 2021, MariaDB Corporation.
+/* Copyright (c) 2016, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -651,10 +651,6 @@ bool Item_func_json_query::fix_length_and_dec()
}
-/*
- Returns NULL, not an error if the found value
- is not a scalar.
-*/
bool Json_path_extractor::extract(String *str, Item *item_js, Item *item_jp,
CHARSET_INFO *cs)
{
@@ -687,6 +683,9 @@ continue_search:
if (json_read_value(&je))
return true;
+ if (je.value_type == JSON_VALUE_NULL)
+ return true;
+
if (unlikely(check_and_get_value(&je, str, &error)))
{
if (error)
@@ -1169,7 +1168,6 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
case JSON_VALUE_ARRAY:
case JSON_VALUE_FALSE:
case JSON_VALUE_UNINITIALIZED:
- // TODO: fix: NULL should be NULL
case JSON_VALUE_NULL:
int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
return to;
@@ -1798,7 +1796,7 @@ bool Item_func_json_array::fix_length_and_dec()
return TRUE;
for (n_arg=0 ; n_arg < arg_count ; n_arg++)
- char_length+= args[n_arg]->max_char_length() + 4;
+ char_length+= static_cast<ulonglong>(args[n_arg]->max_char_length()) + 4;
fix_char_length_ulonglong(char_length);
tmp_val.set_charset(collation.collation);
@@ -1857,7 +1855,8 @@ bool Item_func_json_array_append::fix_length_and_dec()
for (n_arg= 1; n_arg < arg_count; n_arg+= 2)
{
paths[n_arg/2].set_constant_flag(args[n_arg]->const_item());
- char_length+= args[n_arg/2+1]->max_char_length() + 4;
+ char_length+=
+ static_cast<ulonglong>(args[n_arg+1]->max_char_length()) + 4;
}
fix_char_length_ulonglong(char_length);
@@ -3017,7 +3016,8 @@ bool Item_func_json_insert::fix_length_and_dec()
for (n_arg= 1; n_arg < arg_count; n_arg+= 2)
{
paths[n_arg/2].set_constant_flag(args[n_arg]->const_item());
- char_length+= args[n_arg/2+1]->max_char_length() + 4;
+ char_length+=
+ static_cast<ulonglong>(args[n_arg+1]->max_char_length()) + 4;
}
fix_char_length_ulonglong(char_length);