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

Function json_make_array

storage/connect/jsonudf.cpp:2115–2143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2113} // end of json_make_array_init
2114
2115char *json_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result,
2116 unsigned long *res_length, uchar *, uchar *)
2117{
2118 char *str;
2119 PGLOBAL g = (PGLOBAL)initid->ptr;
2120
2121 if (!g->Xchk) {
2122 if (!CheckMemory(g, initid, args, args->arg_count, false)) {
2123 PJAR arp = new(g)JARRAY;
2124
2125 for (uint i = 0; i < args->arg_count; i++)
2126 arp->AddArrayValue(g, MakeValue(g, args, i));
2127
2128 arp->InitArray(g);
2129
2130 if (!(str = Serialize(g, arp, NULL, 0)))
2131 str = strcpy(result, g->Message);
2132
2133 } else
2134 str = strcpy(result, g->Message);
2135
2136 // Keep result of constant function
2137 g->Xchk = (initid->const_item) ? str : NULL;
2138 } else
2139 str = (char*)g->Xchk;
2140
2141 *res_length = strlen(str);
2142 return str;
2143} // end of json_make_array
2144
2145void json_make_array_deinit(UDF_INIT* initid)
2146{

Callers

nothing calls this directly

Calls 5

CheckMemoryFunction · 0.85
MakeValueFunction · 0.85
SerializeFunction · 0.85
InitArrayMethod · 0.80
AddArrayValueMethod · 0.45

Tested by

no test coverage detected