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

Function json_make_object

storage/connect/jsonudf.cpp:2662–2691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2660} // end of json_make_object_init
2661
2662char *json_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result,
2663 unsigned long *res_length, uchar *, uchar *)
2664{
2665 char *str = NULL;
2666 PGLOBAL g = (PGLOBAL)initid->ptr;
2667
2668 if (!g->Xchk) {
2669 if (!CheckMemory(g, initid, args, args->arg_count, false, false, true)) {
2670 PJOB objp;
2671
2672 if ((objp = (PJOB)JsonNew(g, TYPE_JOB))) {
2673 for (uint i = 0; i < args->arg_count; i++)
2674 objp->SetKeyValue(g, MakeValue(g, args, i), MakeKey(g, args, i));
2675
2676 str = Serialize(g, objp, NULL, 0);
2677 } // endif objp
2678
2679 } // endif CheckMemory
2680
2681 if (!str)
2682 str = strcpy(result, g->Message);
2683
2684 // Keep result of constant function
2685 g->Xchk = (initid->const_item) ? str : NULL;
2686 } else
2687 str = (char*)g->Xchk;
2688
2689 *res_length = strlen(str);
2690 return str;
2691} // end of json_make_object
2692
2693void json_make_object_deinit(UDF_INIT* initid)
2694{

Callers

nothing calls this directly

Calls 6

CheckMemoryFunction · 0.85
JsonNewFunction · 0.85
MakeValueFunction · 0.85
MakeKeyFunction · 0.85
SerializeFunction · 0.85
SetKeyValueMethod · 0.45

Tested by

no test coverage detected