MCPcopy Create free account
hub / github.com/MariaDB/server / compare_e_json_str_basic

Method compare_e_json_str_basic

sql/item_jsonfunc.cc:4673–4718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4671
4672
4673int Arg_comparator::compare_e_json_str_basic(Item *j, Item *s)
4674{
4675 String *res1,*res2;
4676 json_value_types type;
4677 char *value;
4678 int value_len, c_len;
4679 Item_func_json_extract *e= (Item_func_json_extract *) j;
4680
4681 res1= e->read_json(&value1, &type, &value, &value_len);
4682 res2= s->val_str(&value2);
4683
4684 if (!res1 || !res2)
4685 return MY_TEST(res1 == res2);
4686
4687 if (type == JSON_VALUE_STRING)
4688 {
4689 if (value1.realloc_with_extra_if_needed(value_len))
4690 {
4691 my_error(ER_OUTOFMEMORY, MYF(0), value_len);
4692 return 1;
4693 }
4694 if ((c_len= json_unescape(value1.charset(), (uchar *) value,
4695 (uchar *) value+value_len,
4696 &my_charset_utf8mb4_bin,
4697 (uchar *) value1.ptr(),
4698 (uchar *) (value1.ptr() + value_len))) < 0)
4699 {
4700 if (current_thd)
4701 {
4702 if (c_len == JSON_ERROR_OUT_OF_SPACE)
4703 my_error(ER_OUTOFMEMORY, MYF(0), value_len);
4704 else if (c_len == JSON_ERROR_ILLEGAL_SYMBOL)
4705 {
4706 push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
4707 ER_JSON_BAD_CHR, ER_THD(current_thd, ER_JSON_BAD_CHR),
4708 0, "equality comparison", 0);
4709 }
4710 }
4711 return 1;
4712 }
4713 value1.length(c_len);
4714 res1= &value1;
4715 }
4716
4717 return MY_TEST(sortcmp(res1, res2, compare_collation()) == 0);
4718}
4719
4720bool Item_func_json_arrayagg::fix_fields(THD *thd, Item **ref)
4721{

Callers

nothing calls this directly

Calls 10

my_errorFunction · 0.85
json_unescapeFunction · 0.85
push_warning_printfFunction · 0.85
sortcmpFunction · 0.85
read_jsonMethod · 0.80
val_strMethod · 0.45
charsetMethod · 0.45
ptrMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected