| 4978 | } // end of jbin_array_delete_init |
| 4979 | |
| 4980 | char *jbin_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 4981 | unsigned long *res_length, uchar *is_null, uchar *error) |
| 4982 | { |
| 4983 | PJSON top = NULL; |
| 4984 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 4985 | PBSON bsp = (PBSON)g->Xchk; |
| 4986 | |
| 4987 | if (bsp && !bsp->Changed) { |
| 4988 | // This constant function was recalled |
| 4989 | *res_length = sizeof(BSON); |
| 4990 | return (char*)bsp; |
| 4991 | } // endif bsp |
| 4992 | |
| 4993 | if (!CheckMemory(g, initid, args, 1, false, false, true)) { |
| 4994 | int *x; |
| 4995 | uint n = 1; |
| 4996 | PJAR arp; |
| 4997 | PJVAL jvp = MakeTypedValue(g, args, 0, TYPE_JSON, &top); |
| 4998 | |
| 4999 | if (CheckPath(g, args, top, jvp, 1)) |
| 5000 | PUSH_WARNING(g->Message); |
| 5001 | else if (jvp && jvp->GetValType() == TYPE_JAR) { |
| 5002 | if ((x = GetIntArgPtr(g, args, n))) { |
| 5003 | arp = jvp->GetArray(); |
| 5004 | arp->DeleteValue(*x); |
| 5005 | arp->InitArray(GetMemPtr(g, args, 0)); |
| 5006 | } else |
| 5007 | PUSH_WARNING("Missing or null array index"); |
| 5008 | |
| 5009 | } else { |
| 5010 | PUSH_WARNING("First argument target is not an array"); |
| 5011 | // if (g->Mrr) *error = 1; |
| 5012 | } // endif jvp |
| 5013 | |
| 5014 | } // endif CheckMemory |
| 5015 | |
| 5016 | // In case of error unchanged argument will be returned |
| 5017 | bsp = MakeBinResult(g, args, top, initid->max_length); |
| 5018 | |
| 5019 | if (initid->const_item) |
| 5020 | // Keep result of constant function |
| 5021 | g->Xchk = bsp; |
| 5022 | |
| 5023 | if (!bsp) { |
| 5024 | *is_null = 1; |
| 5025 | *error = 1; |
| 5026 | *res_length = 0; |
| 5027 | } else |
| 5028 | *res_length = sizeof(BSON); |
| 5029 | |
| 5030 | return (char*)bsp; |
| 5031 | } // end of jbin_array_delete |
| 5032 | |
| 5033 | void jbin_array_delete_deinit(UDF_INIT* initid) |
| 5034 | { |
nothing calls this directly
no test coverage detected