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

Function bbin_array_delete

storage/connect/bsonudf.cpp:5432–5474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5430} // end of bbin_array_delete_init
5431
5432char *bbin_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result,
5433 unsigned long *res_length, uchar *is_null, uchar *error)
5434{
5435 PGLOBAL g = (PGLOBAL)initid->ptr;
5436 PBSON bsp = NULL;
5437
5438 if (g->Xchk) {
5439 // This constant function was recalled
5440 bsp = (PBSON)g->Xchk;
5441 } else if (!CheckMemory(g, initid, args, 1, false, false, true)) {
5442 int* x;
5443 uint n = 1;
5444 BJNX bnx(g);
5445 PBVAL arp, top;
5446 PBVAL jvp = bnx.MakeValue(args, 0, true, &top);
5447
5448 if (!(x = GetIntArgPtr(g, args, n)))
5449 PUSH_WARNING("Missing or null array index");
5450 else if (bnx.CheckPath(g, args, jvp, arp, 1))
5451 PUSH_WARNING(g->Message);
5452 else if (arp && arp->Type == TYPE_JAR) {
5453 bnx.SetChanged(bnx.DeleteValue(arp, *x));
5454 bsp = bnx.MakeBinResult(args, top, initid->max_length);
5455 } else {
5456 PUSH_WARNING("First argument target is not an array");
5457 // if (g->Mrr) *error = 1;
5458 } // endif jvp
5459
5460 if (g->N)
5461 // Keep result of constant function
5462 g->Xchk = bsp;
5463
5464 } // endif CheckMemory
5465
5466 if (!bsp) {
5467 *is_null = 1;
5468 *error = 1;
5469 *res_length = 0;
5470 } else
5471 *res_length = sizeof(BSON);
5472
5473 return (char*)bsp;
5474} // end of bbin_array_delete
5475
5476void bbin_array_delete_deinit(UDF_INIT* initid)
5477{

Callers

nothing calls this directly

Calls 7

CheckMemoryFunction · 0.85
MakeValueMethod · 0.80
SetChangedMethod · 0.80
MakeBinResultMethod · 0.80
GetIntArgPtrFunction · 0.70
CheckPathMethod · 0.45
DeleteValueMethod · 0.45

Tested by

no test coverage detected