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

Function compare_nested_object

sql/item_jsonfunc.cc:5135–5172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5133
5134
5135int compare_nested_object(json_engine_t *js, json_engine_t *value,
5136 MEM_ROOT *current_mem_root,
5137 json_engine_t *temp_je,
5138 MEM_ROOT_DYNAMIC_ARRAY *stack)
5139{
5140 int result= 0;
5141 const char *value_begin= (const char*)value->s.c_str-1;
5142 const char *js_begin= (const char*)js->s.c_str-1;
5143 json_skip_level(value);
5144 json_skip_level(js);
5145 const char *value_end= (const char*)value->s.c_str;
5146 const char *js_end= (const char*)js->s.c_str;
5147
5148 String a(value_begin, value_end-value_begin,value->s.cs);
5149 String b(js_begin, js_end-js_begin, js->s.cs);
5150
5151 DYNAMIC_STRING a_res, b_res;
5152 if (init_dynamic_string(&a_res, NULL, BLOCK_SIZE_JSON_DYN_ARRAY, 1024) ||
5153 init_dynamic_string(&b_res, NULL, BLOCK_SIZE_JSON_DYN_ARRAY, 1024))
5154 {
5155 goto error;
5156 }
5157 if (json_normalize(&a_res, a.ptr(), a.length(), value->s.cs,
5158 current_mem_root, temp_je, stack) ||
5159 json_normalize(&b_res, b.ptr(), b.length(), value->s.cs,
5160 current_mem_root, temp_je, stack))
5161 {
5162 goto error;
5163 }
5164
5165 result= strcmp(a_res.str, b_res.str) ? 0 : 1;
5166
5167 error:
5168 dynstr_free(&a_res);
5169 dynstr_free(&b_res);
5170
5171 return MY_TEST(result);
5172}
5173
5174
5175static int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,

Callers 1

Calls 5

init_dynamic_stringFunction · 0.85
json_normalizeFunction · 0.85
dynstr_freeFunction · 0.85
ptrMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected