| 5368 | } // end of jbin_object_list_init |
| 5369 | |
| 5370 | char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 5371 | unsigned long *res_length, uchar *is_null, uchar *error) |
| 5372 | { |
| 5373 | PJAR jarp = NULL; |
| 5374 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 5375 | PBSON bsp = (PBSON)g->Xchk; |
| 5376 | |
| 5377 | if (!bsp || bsp->Changed) { |
| 5378 | if (!CheckMemory(g, initid, args, 1, true, true)) { |
| 5379 | char *p; |
| 5380 | PJSON jsp; |
| 5381 | PJVAL jvp = MakeValue(g, args, 0); |
| 5382 | |
| 5383 | if ((p = jvp->GetString(g))) { |
| 5384 | if (!(jsp = ParseJson(g, p, strlen(p)))) { |
| 5385 | PUSH_WARNING(g->Message); |
| 5386 | return NULL; |
| 5387 | } // endif jsp |
| 5388 | |
| 5389 | } else |
| 5390 | jsp = jvp->GetJson(); |
| 5391 | |
| 5392 | if (jsp->GetType() == TYPE_JOB) { |
| 5393 | jarp = ((PJOB)jsp)->GetKeyList(g); |
| 5394 | } else { |
| 5395 | PUSH_WARNING("First argument is not an object"); |
| 5396 | if (g->Mrr) *error = 1; |
| 5397 | } // endif jsp type |
| 5398 | |
| 5399 | } // endif CheckMemory |
| 5400 | |
| 5401 | if ((bsp = JbinAlloc(g, args, initid->max_length, jarp))) |
| 5402 | safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); |
| 5403 | |
| 5404 | // Keep result of constant function |
| 5405 | g->Xchk = (initid->const_item) ? bsp : NULL; |
| 5406 | } // endif bsp |
| 5407 | |
| 5408 | if (!bsp) { |
| 5409 | *is_null = 1; |
| 5410 | *error = 1; |
| 5411 | *res_length = 0; |
| 5412 | } else |
| 5413 | *res_length = sizeof(BSON); |
| 5414 | |
| 5415 | return (char*)bsp; |
| 5416 | } // end of jbin_object_list |
| 5417 | |
| 5418 | void jbin_object_list_deinit(UDF_INIT* initid) |
| 5419 | { |
nothing calls this directly
no test coverage detected