| 3080 | } // end of json_object_list_init |
| 3081 | |
| 3082 | char *json_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 3083 | unsigned long *res_length, uchar *is_null, uchar *error) |
| 3084 | { |
| 3085 | char *str = NULL; |
| 3086 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 3087 | |
| 3088 | if (!g->N) { |
| 3089 | if (!CheckMemory(g, initid, args, 1, true, true)) { |
| 3090 | char *p; |
| 3091 | PJSON jsp; |
| 3092 | PJVAL jvp = MakeValue(g, args, 0); |
| 3093 | |
| 3094 | if ((p = jvp->GetString(g))) { |
| 3095 | if (!(jsp = ParseJson(g, p, strlen(p)))) { |
| 3096 | PUSH_WARNING(g->Message); |
| 3097 | return NULL; |
| 3098 | } // endif jsp |
| 3099 | |
| 3100 | } else |
| 3101 | jsp = jvp->GetJson(); |
| 3102 | |
| 3103 | if (jsp->GetType() == TYPE_JOB) { |
| 3104 | PJAR jarp = ((PJOB)jsp)->GetValList(g); |
| 3105 | |
| 3106 | if (!(str = Serialize(g, jarp, NULL, 0))) |
| 3107 | PUSH_WARNING(g->Message); |
| 3108 | |
| 3109 | } else { |
| 3110 | PUSH_WARNING("First argument is not an object"); |
| 3111 | if (g->Mrr) *error = 1; |
| 3112 | } // endif jvp |
| 3113 | |
| 3114 | } // endif CheckMemory |
| 3115 | |
| 3116 | if (initid->const_item) { |
| 3117 | // Keep result of constant function |
| 3118 | g->Xchk = str; |
| 3119 | g->N = 1; // str can be NULL |
| 3120 | } // endif const_item |
| 3121 | |
| 3122 | } else |
| 3123 | str = (char*)g->Xchk; |
| 3124 | |
| 3125 | if (!str) { |
| 3126 | *is_null = 1; |
| 3127 | *res_length = 0; |
| 3128 | } else |
| 3129 | *res_length = strlen(str); |
| 3130 | |
| 3131 | return str; |
| 3132 | } // end of json_object_values |
| 3133 | |
| 3134 | void json_object_values_deinit(UDF_INIT* initid) |
| 3135 | { |
nothing calls this directly
no test coverage detected