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

Function json_get_normalized_string

sql/json_schema_helper.cc:61–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void json_get_normalized_string(json_engine_t *je, String *res,
62 int *error, MEM_ROOT *current_mem_root,
63 json_engine_t *temp_je,
64 MEM_ROOT_DYNAMIC_ARRAY *stack)
65{
66 char *val_begin= (char*)je->value, *val_end= NULL;
67 String val("",0,je->s.cs);
68 DYNAMIC_STRING a_res;
69
70 if (init_dynamic_string(&a_res, NULL, 0, 0))
71 goto error;
72
73 if (!json_value_scalar(je))
74 {
75 if (json_skip_level(je))
76 goto error;
77 }
78
79 val_end= json_value_scalar(je) ? val_begin+je->value_len :
80 (char *)je->s.c_str;
81 val.set((const char*)val_begin, val_end-val_begin, je->s.cs);
82
83 if (je->value_type == JSON_VALUE_NUMBER ||
84 je->value_type == JSON_VALUE_ARRAY ||
85 je->value_type == JSON_VALUE_OBJECT)
86 {
87 if (json_normalize(&a_res, (const char*)val.ptr(),
88 val_end-val_begin, je->s.cs, current_mem_root, temp_je, stack))
89 goto error;
90 }
91 else if(je->value_type == JSON_VALUE_STRING)
92 {
93 dynstr_set(&a_res, val.c_ptr());
94 a_res.length= je->value_len;
95 }
96
97 res->append(a_res.str, a_res.length, je->s.cs);
98 *error= 0;
99
100 error:
101 dynstr_free(&a_res);
102
103 return;
104}

Callers 2

validateMethod · 0.85
handle_keywordMethod · 0.85

Calls 8

init_dynamic_stringFunction · 0.85
json_normalizeFunction · 0.85
dynstr_setFunction · 0.85
dynstr_freeFunction · 0.85
setMethod · 0.45
ptrMethod · 0.45
c_ptrMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected