| 3004 | } // end of json_object_list_init |
| 3005 | |
| 3006 | char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 3007 | unsigned long *res_length, uchar *is_null, uchar *error) |
| 3008 | { |
| 3009 | char *str = NULL; |
| 3010 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 3011 | |
| 3012 | if (!g->N) { |
| 3013 | if (!CheckMemory(g, initid, args, 1, true, true)) { |
| 3014 | char *p; |
| 3015 | PJSON jsp; |
| 3016 | PJVAL jvp = MakeValue(g, args, 0); |
| 3017 | |
| 3018 | if ((p = jvp->GetString(g))) { |
| 3019 | if (!(jsp = ParseJson(g, p, strlen(p)))) { |
| 3020 | PUSH_WARNING(g->Message); |
| 3021 | return NULL; |
| 3022 | } // endif jsp |
| 3023 | |
| 3024 | } else |
| 3025 | jsp = jvp->GetJson(); |
| 3026 | |
| 3027 | if (jsp->GetType() == TYPE_JOB) { |
| 3028 | PJAR jarp = ((PJOB)jsp)->GetKeyList(g); |
| 3029 | |
| 3030 | if (!(str = Serialize(g, jarp, NULL, 0))) |
| 3031 | PUSH_WARNING(g->Message); |
| 3032 | |
| 3033 | } else { |
| 3034 | PUSH_WARNING("First argument is not an object"); |
| 3035 | if (g->Mrr) *error = 1; |
| 3036 | } // endif jvp |
| 3037 | |
| 3038 | } // endif CheckMemory |
| 3039 | |
| 3040 | if (initid->const_item) { |
| 3041 | // Keep result of constant function |
| 3042 | g->Xchk = str; |
| 3043 | g->N = 1; // str can be NULL |
| 3044 | } // endif const_item |
| 3045 | |
| 3046 | } else |
| 3047 | str = (char*)g->Xchk; |
| 3048 | |
| 3049 | if (!str) { |
| 3050 | *is_null = 1; |
| 3051 | *res_length = 0; |
| 3052 | } else |
| 3053 | *res_length = strlen(str); |
| 3054 | |
| 3055 | return str; |
| 3056 | } // end of json_object_list |
| 3057 | |
| 3058 | void json_object_list_deinit(UDF_INIT* initid) |
| 3059 | { |
nothing calls this directly
no test coverage detected