MCPcopy Create free account
hub / github.com/MariaDB/server / json_serialize

Function json_serialize

storage/connect/jsonudf.cpp:5891–5918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5889} // end of json_serialize_init
5890
5891char *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
5920void json_serialize_deinit(UDF_INIT* initid)
5921{

Callers

nothing calls this directly

Calls 3

IsJsonFunction · 0.85
JsonSubSetFunction · 0.85
SerializeFunction · 0.85

Tested by

no test coverage detected