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

Function bson_make_array

storage/connect/bsonudf.cpp:2020–2050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2018} // end of bson_make_array_init
2019
2020char* bson_make_array(UDF_INIT* initid, UDF_ARGS* args, char* result,
2021 unsigned long* res_length, uchar *, uchar *)
2022{
2023 char* str = NULL;
2024 PGLOBAL g = (PGLOBAL)initid->ptr;
2025
2026 if (!g->Xchk) {
2027 if (!CheckMemory(g, initid, args, args->arg_count, false)) {
2028 BJNX bnx(g);
2029 PBVAL jvp = bnx.MakeValue(args, 0);
2030 PBVAL arp = bnx.NewVal(TYPE_JAR);
2031
2032 for (uint i = 0; i < args->arg_count;) {
2033 bnx.AddArrayValue(arp, jvp);
2034 jvp = bnx.MakeValue(args, ++i);
2035 } // endfor i
2036
2037 if (!(str = bnx.Serialize(g, arp, NULL, 0)))
2038 str = strcpy(result, g->Message);
2039
2040 } else
2041 str = strcpy(result, g->Message);
2042
2043 // Keep result of constant function
2044 g->Xchk = (initid->const_item) ? str : NULL;
2045 } else
2046 str = (char*)g->Xchk;
2047
2048 *res_length = strlen(str);
2049 return str;
2050} // end of bson_make_array
2051
2052void bson_make_array_deinit(UDF_INIT* initid) {
2053 JsonFreeMem((PGLOBAL)initid->ptr);

Callers

nothing calls this directly

Calls 5

CheckMemoryFunction · 0.85
MakeValueMethod · 0.80
NewValMethod · 0.80
AddArrayValueMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected