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

Function json_array_grp_init

storage/connect/jsonudf.cpp:3181–3206  ·  view source on GitHub ↗

/ Make a Json array from values coming from rows. */ /

Source from the content-addressed store, hash-verified

3179/* Make a Json array from values coming from rows. */
3180/*********************************************************************************/
3181my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
3182{
3183 unsigned long reslen, memlen, n = GetJsonGroupSize();
3184
3185 if (args->arg_count != 1) {
3186 strcpy(message, "This function can only accept 1 argument");
3187 return true;
3188 } else if (IsJson(args, 0) == 3) {
3189 strcpy(message, "This function does not support Jbin arguments");
3190 return true;
3191 } else
3192 CalcLen(args, false, reslen, memlen);
3193
3194 reslen *= n;
3195 memlen += ((memlen - MEMFIX) * (n - 1));
3196
3197 if (JsonInit(initid, args, message, false, reslen, memlen))
3198 return true;
3199
3200 PGLOBAL g = (PGLOBAL)initid->ptr;
3201
3202 PlugSubSet(g->Sarea, g->Sarea_Size);
3203 g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
3204 g->N = (int)n;
3205 return false;
3206} // end of json_array_grp_init
3207
3208void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *)
3209{

Callers

nothing calls this directly

Calls 6

GetJsonGroupSizeFunction · 0.85
IsJsonFunction · 0.85
CalcLenFunction · 0.85
JsonInitFunction · 0.85
PlugSubSetFunction · 0.85
JsonNewFunction · 0.85

Tested by

no test coverage detected