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

Function bson_object_grp_init

storage/connect/bsonudf.cpp:2963–2987  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2961/* Make a Json object from values coming from rows. */
2962/*********************************************************************************/
2963my_bool bson_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
2964{
2965 unsigned long reslen, memlen, n = GetJsonGroupSize();
2966
2967 if (args->arg_count != 2) {
2968 strcpy(message, "This function requires 2 arguments (key, value)");
2969 return true;
2970 } else if (IsArgJson(args, 0) == 3) {
2971 strcpy(message, "This function does not support Jbin arguments");
2972 return true;
2973 } else
2974 CalcLen(args, true, reslen, memlen);
2975
2976 reslen *= n;
2977 memlen += ((memlen - MEMFIX) * (n - 1));
2978
2979 if (JsonInit(initid, args, message, false, reslen, memlen))
2980 return true;
2981
2982 PGLOBAL g = (PGLOBAL)initid->ptr;
2983 (void) new(g) BJNX(g);
2984
2985 JsonMemSave(g);
2986 return false;
2987} // end of bson_object_grp_init
2988
2989void bson_object_grp_clear(UDF_INIT *initid, uchar *, uchar *)
2990{

Callers 1

bbin_object_grp_initFunction · 0.85

Calls 5

GetJsonGroupSizeFunction · 0.85
IsArgJsonFunction · 0.85
CalcLenFunction · 0.85
JsonInitFunction · 0.85
JsonMemSaveFunction · 0.70

Tested by

no test coverage detected