| 5889 | } // end of json_serialize_init |
| 5890 | |
| 5891 | char *json_serialize(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 5892 | unsigned long *res_length, uchar *, uchar *error) |
| 5893 | { |
| 5894 | char *str; |
| 5895 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 5896 | |
| 5897 | if (!g->Xchk) { |
| 5898 | if (IsJson(args, 0) == 3) { |
| 5899 | PBSON bsp = (PBSON)args->args[0]; |
| 5900 | |
| 5901 | JsonSubSet(g); |
| 5902 | |
| 5903 | if (!(str = Serialize(g, bsp->Jsp, NULL, 0))) |
| 5904 | str = strcpy(result, g->Message); |
| 5905 | |
| 5906 | // Keep result of constant function |
| 5907 | g->Xchk = (initid->const_item) ? str : NULL; |
| 5908 | } else { |
| 5909 | // *error = 1; |
| 5910 | str = strcpy(result, "Argument is not a Jbin tree"); |
| 5911 | } // endif |
| 5912 | |
| 5913 | } else |
| 5914 | str = (char*)g->Xchk; |
| 5915 | |
| 5916 | *res_length = strlen(str); |
| 5917 | return str; |
| 5918 | } // end of json_serialize |
| 5919 | |
| 5920 | void json_serialize_deinit(UDF_INIT* initid) |
| 5921 | { |
nothing calls this directly
no test coverage detected