/ Make a Json object from values coming from rows. */ /
| 3256 | /* Make a Json object from values coming from rows. */ |
| 3257 | /*********************************************************************************/ |
| 3258 | my_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 | |
| 3285 | void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) |
| 3286 | { |
nothing calls this directly
no test coverage detected