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

Function jsonvalue

storage/connect/jsonudf.cpp:2074–2097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2072} // end of jsonvalue_init
2073
2074char *jsonvalue(UDF_INIT *initid, UDF_ARGS *args, char *result,
2075 unsigned long *res_length, uchar *, uchar *)
2076{
2077 char *str;
2078 PGLOBAL g = (PGLOBAL)initid->ptr;
2079
2080 if (!g->Xchk) {
2081 if (!CheckMemory(g, initid, args, 1, false)) {
2082 PJVAL jvp = MakeValue(g, args, 0);
2083
2084 if (!(str = Serialize(g, jvp, NULL, 0)))
2085 str = strcpy(result, g->Message);
2086
2087 } else
2088 str = strcpy(result, g->Message);
2089
2090 // Keep result of constant function
2091 g->Xchk = (initid->const_item) ? str : NULL;
2092 } else
2093 str = (char*)g->Xchk;
2094
2095 *res_length = strlen(str);
2096 return str;
2097} // end of JsonValue
2098
2099void jsonvalue_deinit(UDF_INIT* initid)
2100{

Callers

nothing calls this directly

Calls 3

CheckMemoryFunction · 0.85
MakeValueFunction · 0.85
SerializeFunction · 0.85

Tested by

no test coverage detected