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

Function bson_array_grp_init

storage/connect/bsonudf.cpp:2890–2914  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2888/* Make a Json array from values coming from rows. */
2889/*********************************************************************************/
2890my_bool bson_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
2891{
2892 unsigned long reslen, memlen, n = GetJsonGroupSize();
2893
2894 if (args->arg_count != 1) {
2895 strcpy(message, "This function can only accept 1 argument");
2896 return true;
2897 } else if (IsArgJson(args, 0) == 3) {
2898 strcpy(message, "This function does not support Jbin arguments");
2899 return true;
2900 } else
2901 CalcLen(args, false, reslen, memlen);
2902
2903 reslen *= n;
2904 memlen += ((memlen - MEMFIX) * (n - 1));
2905
2906 if (JsonInit(initid, args, message, false, reslen, memlen))
2907 return true;
2908
2909 PGLOBAL g = (PGLOBAL)initid->ptr;
2910 (void) new(g) BJNX(g);
2911
2912 JsonMemSave(g);
2913 return false;
2914} // end of bson_array_grp_init
2915
2916void bson_array_grp_clear(UDF_INIT *initid, uchar *, uchar *)
2917{

Callers 1

bbin_array_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