| 2660 | } // end of json_make_object_init |
| 2661 | |
| 2662 | char *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 | |
| 2693 | void json_make_object_deinit(UDF_INIT* initid) |
| 2694 | { |
nothing calls this directly
no test coverage detected