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

Function json_object_grp_init

storage/connect/jsonudf.cpp:3258–3283  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3256/* Make a Json object from values coming from rows. */
3257/*********************************************************************************/
3258my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
3259{
3260 unsigned long reslen, memlen, n = GetJsonGroupSize();
3261
3262 if (args->arg_count != 2) {
3263 strcpy(message, "This function requires 2 arguments (key, value)");
3264 return true;
3265 } else if (IsJson(args, 0) == 3) {
3266 strcpy(message, "This function does not support Jbin arguments");
3267 return true;
3268 } else
3269 CalcLen(args, true, reslen, memlen);
3270
3271 reslen *= n;
3272 memlen += ((memlen - MEMFIX) * (n - 1));
3273
3274 if (JsonInit(initid, args, message, false, reslen, memlen))
3275 return true;
3276
3277 PGLOBAL g = (PGLOBAL)initid->ptr;
3278
3279 PlugSubSet(g->Sarea, g->Sarea_Size);
3280 g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
3281 g->N = (int)n;
3282 return false;
3283} // end of json_object_grp_init
3284
3285void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *)
3286{

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