| 2762 | } // end of json_object_key_init |
| 2763 | |
| 2764 | char *json_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 2765 | unsigned long *res_length, uchar *, uchar *) |
| 2766 | { |
| 2767 | char *str = NULL; |
| 2768 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 2769 | |
| 2770 | if (!g->Xchk) { |
| 2771 | if (!CheckMemory(g, initid, args, args->arg_count, false, true)) { |
| 2772 | PJOB objp; |
| 2773 | |
| 2774 | if ((objp = (PJOB)JsonNew(g, TYPE_JOB))) { |
| 2775 | for (uint i = 0; i < args->arg_count; i += 2) |
| 2776 | objp->SetKeyValue(g, MakeValue(g, args, i + 1), MakePSZ(g, args, i)); |
| 2777 | |
| 2778 | str = Serialize(g, objp, NULL, 0); |
| 2779 | } // endif objp |
| 2780 | |
| 2781 | } // endif CheckMemory |
| 2782 | |
| 2783 | if (!str) |
| 2784 | str = strcpy(result, g->Message); |
| 2785 | |
| 2786 | // Keep result of constant function |
| 2787 | g->Xchk = (initid->const_item) ? str : NULL; |
| 2788 | } else |
| 2789 | str = (char*)g->Xchk; |
| 2790 | |
| 2791 | *res_length = strlen(str); |
| 2792 | return str; |
| 2793 | } // end of json_object_key |
| 2794 | |
| 2795 | void json_object_key_deinit(UDF_INIT* initid) |
| 2796 | { |
nothing calls this directly
no test coverage detected