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

Function bsonvalue

storage/connect/bsonudf.cpp:1978–2002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1976} // end of bsonvalue_init
1977
1978char* bsonvalue(UDF_INIT* initid, UDF_ARGS* args, char* result,
1979 unsigned long* res_length, uchar *, uchar *)
1980{
1981 char *str;
1982 PGLOBAL g = (PGLOBAL)initid->ptr;
1983
1984 if (!g->Xchk) {
1985 if (!CheckMemory(g, initid, args, 1, false)) {
1986 BJNX bnx(g);
1987 PBVAL bvp = bnx.MakeValue(args, 0, true);
1988
1989 if (!(str = bnx.Serialize(g, bvp, NULL, 0)))
1990 str = strcpy(result, g->Message);
1991
1992 } else
1993 str = strcpy(result, g->Message);
1994
1995 // Keep result of constant function
1996 g->Xchk = (initid->const_item) ? str : NULL;
1997 } else
1998 str = (char*)g->Xchk;
1999
2000 *res_length = strlen(str);
2001 return str;
2002} // end of bsonValue
2003
2004void bsonvalue_deinit(UDF_INIT* initid) {
2005 JsonFreeMem((PGLOBAL)initid->ptr);

Callers

nothing calls this directly

Calls 3

CheckMemoryFunction · 0.85
MakeValueMethod · 0.80
SerializeMethod · 0.45

Tested by

no test coverage detected