str DCsliceStrict(int *ret, bat *bid, lng *start, lng *end) { BAT *b, *bn = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "dcoperator.sliceStrict", "Cannot access descriptor"); } assert(*start >= 0); assert(*end >= 0); assert(*start <= (lng) BUN_MAX); assert(*end < (lng) BUN_MAX); assert(*start <= *end); if ((BUN) ((*end - *start) + 1) > BATcount(b)) { bn = BATnew(b->htype, b->ttype, 0); BATsetcount(bn, 0); *ret = bn->batCacheid; BBPkeepref(*ret); return MAL_SUCCEED; } bn = BATslice(b, (BUN) *start, (BUN) *end + 1); BBPreleaseref(b->batCacheid); if (bn != NULL) { if (!(bn->batDirty & 2)) bn = BATsetaccess(bn, BAT_READ); *ret = bn->batCacheid; BBPkeepref(*ret); return MAL_SUCCEED; } throw(MAL, "dcoperator.sliceStrict", "GDKerror"); }
/* * Enable incremental packing. The SQL front-end requires * fixed oid sequences. */ str MATpackIncrement(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) { bat *ret = getArgReference_bat(stk,p,0); int pieces; BAT *b, *bb, *bn; size_t newsize; (void) cntxt; b = BATdescriptor( stk->stk[getArg(p,1)].val.ival); if ( b == NULL) throw(MAL, "mat.pack", RUNTIME_OBJECT_MISSING); if ( getArgType(mb,p,2) == TYPE_int){ /* first step, estimate with some slack */ pieces = stk->stk[getArg(p,2)].val.ival; bn = BATnew(TYPE_void, b->ttype?b->ttype:TYPE_oid, (BUN)(1.2 * BATcount(b) * pieces), TRANSIENT); if (bn == NULL) throw(MAL, "mat.pack", MAL_MALLOC_FAIL); /* allocate enough space for the vheap, but not for strings, * since BATappend does clever things for strings */ if ( b->T->vheap && bn->T->vheap && ATOMstorage(b->ttype) != TYPE_str){ newsize = b->T->vheap->size * pieces; if (HEAPextend(bn->T->vheap, newsize, TRUE) != GDK_SUCCEED) throw(MAL, "mat.pack", MAL_MALLOC_FAIL); } BATseqbase(bn, b->H->seq); BATseqbase(BATmirror(bn), b->T->seq); BATappend(bn,b,FALSE); assert(!bn->H->nil || !bn->H->nonil); assert(!bn->T->nil || !bn->T->nonil); bn->H->align = (pieces-1); BBPkeepref(*ret = bn->batCacheid); BBPunfix(b->batCacheid); } else { /* remaining steps */ bb = BATdescriptor(stk->stk[getArg(p,2)].val.ival); if ( bb ){ if (BATcount(b) == 0) BATseqbase(b, bb->H->seq); if (BATcount(b) == 0) BATseqbase(BATmirror(b), bb->T->seq); BATappend(b,bb,FALSE); } b->H->align--; if(b->H->align == 0) BATsetaccess(b, BAT_READ); assert(!b->H->nil || !b->H->nonil); assert(!b->T->nil || !b->T->nonil); BBPkeepref(*ret = b->batCacheid); if( bb) BBPunfix(bb->batCacheid); } return MAL_SUCCEED; }
/* * The nextChunk version advances the reader, * which also means that the view descriptor is already available. * The granule size may differ in each call. */ str ITRnextChunk(lng *res, int *vid, int *bid, lng *granule) { BAT *b, *view; BUN i; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "iterator.nextChunk", INTERNAL_BAT_ACCESS); } if ((view = BATdescriptor(*vid)) == NULL) { BBPunfix(b->batCacheid); throw(MAL, "iterator.nextChunk", INTERNAL_BAT_ACCESS); } i = (BUN) (*res + BATcount(view)); if (i >= BUNlast(b)) { *res = lng_nil; *vid = 0; BBPunfix(view->batCacheid); BBPunfix(b->batCacheid); return MAL_SUCCEED; } /* printf("set bat chunk bound to " BUNFMT " - " BUNFMT " \n", i, i+(BUN) *granule-1); */ VIEWbounds(b, view, i, i + (BUN) * granule); BATseqbase(view, b->hseqbase == oid_nil ? oid_nil : b->hseqbase + i - BUNfirst(b)); BBPkeepref(*vid = view->batCacheid); BBPunfix(b->batCacheid); *res = i; return MAL_SUCCEED; }
str AGGRsubmin_val(bat *retval, bat *bid, bat *gid, bat *eid, bit *skip_nils) { BAT *a, *b, *r; str res; bat ret; if ((res = AGGRsubgrouped(&ret, NULL, bid, gid, eid, NULL, *skip_nils, 0, TYPE_oid, BATgroupmin, NULL, "aggr.submin")) != MAL_SUCCEED) return res; b = BATdescriptor(*bid); if( b == NULL) throw(MAL,"aggr.submax", INTERNAL_BAT_ACCESS); a = BATdescriptor(ret); if( a == NULL){ BBPreleaseref(b->batCacheid); throw(MAL,"aggr.submax", INTERNAL_BAT_ACCESS); } r = BATproject(a, b); BBPreleaseref(b->batCacheid); BBPreleaseref(a->batCacheid); BBPdecref(ret, TRUE); BBPkeepref(*retval = r->batCacheid); return MAL_SUCCEED; }
static str CMDbatUNARY1(MalStkPtr stk, InstrPtr pci, int abort_on_error, BAT *(*batfunc)(BAT *, BAT *, int), const char *malfunc) { bat *bid; BAT *bn, *b, *s = NULL; bid = getArgReference_bat(stk, pci, 1); if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); if (pci->argc == 3) { bat *sid = getArgReference_bat(stk, pci, 2); if (*sid && (s = BATdescriptor(*sid)) == NULL) { BBPunfix(b->batCacheid); throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); } } bn = (*batfunc)(b, s, abort_on_error); BBPunfix(b->batCacheid); if (s) BBPunfix(s->batCacheid); if (bn == NULL) { return mythrow(MAL, malfunc, OPERATION_FAILED); } bid = getArgReference_bat(stk, pci, 0); BBPkeepref(*bid = bn->batCacheid); return MAL_SUCCEED; }
str BKCsetAccess(bat *res, const bat *bid, const char * const *param) { BAT *b; int m; if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.setAccess", RUNTIME_OBJECT_MISSING); switch (*param[0]) { case 'r': m = BAT_READ; break; case 'a': m = BAT_APPEND; break; case 'w': m = BAT_WRITE; break; default: *res = 0; throw(MAL, "bat.setAccess", ILLEGAL_ARGUMENT " Got %c" " expected 'r','a', or 'w'", *param[0]); } if ((b = setaccess(b, m)) == NULL) throw(MAL, "bat.setAccess", OPERATION_FAILED); BBPkeepref(*res = b->batCacheid); return MAL_SUCCEED; }
static str CMDconvertbat(MalStkPtr stk, InstrPtr pci, int tp, int abort_on_error) { bat *bid; BAT *b, *bn, *s = NULL; bid = getArgReference_bat(stk, pci, 1); if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "batcalc.convert", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); if (pci->argc == 3) { bat *sid = getArgReference_bat(stk, pci, 2); if (*sid && (s = BATdescriptor(*sid)) == NULL) { BBPunfix(b->batCacheid); throw(MAL, "batcalc.convert", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); } } bn = BATconvert(b, s, tp, abort_on_error); BBPunfix(b->batCacheid); if (s) BBPunfix(s->batCacheid); if (bn == NULL) { char buf[20]; snprintf(buf, sizeof(buf), "batcalc.%s", ATOMname(tp)); return mythrow(MAL, buf, OPERATION_FAILED); } bid = getArgReference_bat(stk, pci, 0); BBPkeepref(*bid = bn->batCacheid); return MAL_SUCCEED; }
str AGGRsubmaxcand_val(bat *retval, bat *bid, bat *gid, bat *eid, bat *sid, bit *skip_nils) { BAT *a, *b, *r; str res; bat ret; if ((res = AGGRsubgrouped(&ret, NULL, bid, gid, eid, sid, *skip_nils, 0, TYPE_oid, BATgroupmax, NULL, "aggr.submax")) != MAL_SUCCEED) return res; b = BATdescriptor(*bid); if ( b == NULL) throw(MAL,"aggr.max",RUNTIME_OBJECT_MISSING); a = BATdescriptor(ret); if ( a == NULL){ BBPreleaseref(b->batCacheid); throw(MAL,"aggr.max",RUNTIME_OBJECT_MISSING); } r = BATproject(a, b); BBPreleaseref(b->batCacheid); BBPreleaseref(a->batCacheid); BBPdecref(ret, TRUE); BBPkeepref(*retval = r->batCacheid); return MAL_SUCCEED; }
str JSONvalueTable(bat *ret, json *js) { BAT *bn; char *r; int i; JSON *jt; jt = JSONparse(*js, FALSE); // already validated CHECK_JSON(jt); bn = BATnew(TYPE_void, TYPE_json, 64, TRANSIENT); if (bn == NULL) throw(MAL, "json.values", MAL_MALLOC_FAIL); BATseqbase(bn, 0); bn->hsorted = 1; bn->hrevsorted = 0; bn->H->nonil = 1; bn->tsorted = 1; bn->trevsorted = 0; bn->T->nonil = 1; for (i = jt->elm[0].next; i; i = jt->elm[i].next) { if (jt->elm[i].kind == JSON_ELEMENT) r = JSONgetValue(jt, jt->elm[i].child); else r = JSONgetValue(jt, i); BUNappend(bn, r, FALSE); GDKfree(r); } BBPkeepref(*ret = bn->batCacheid); return MAL_SUCCEED; }
str MseedLoadSQL(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int *ret = (int*) getArgReference(stk,pci,0); str *targetfile = (str*) getArgReference(stk,pci,1); str msg = MAL_SUCCEED; BAT *btime, *bdata, *table; (void) cntxt; (void) mb; /* XXX: BATs of BATs are no longer allowed and this code hasn't worked * for quite some time anyway */ table = BATnew(TYPE_str,TYPE_bat,0); if ( table == NULL) throw(MAL, "mseed.load", MAL_MALLOC_FAIL); msg = MseedLoadIntern(&btime, &bdata, *targetfile); if ( msg == MAL_SUCCEED){ BUNins(table, (ptr)"time", (ptr)&btime->batCacheid, FALSE); BUNins(table, (ptr)"data", (ptr)&bdata->batCacheid, FALSE); BBPreleaseref(btime->batCacheid); BBPreleaseref(bdata->batCacheid); BBPkeepref(*ret= table->batCacheid); } return msg; }
str MATpackValues(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) { int i,*ret, type, first = 1; BAT *bn; (void) cntxt; type = getArgType(mb,p,first); bn = BATnew(TYPE_void, type, p->argc, TRANSIENT); if( bn == NULL) throw(MAL, "mat.pack", MAL_MALLOC_FAIL); if (ATOMvarsized(type)) { for(i = first; i < p->argc; i++) BUNappend(bn, stk->stk[getArg(p,i)].val.sval, TRUE); } else { for(i = first; i < p->argc; i++) BUNappend(bn, getArgReference(stk, p, i), TRUE); } BATsettrivprop(bn); BATderiveProps(bn,FALSE); ret= (int*) getArgReference(stk,p,0); BBPkeepref(*ret = bn->batCacheid); return MAL_SUCCEED; }
str BKCbat_inplace_force(bat *r, const bat *bid, const bat *rid, const bat *uid, const bit *force) { BAT *b, *p, *u; if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.inplace", RUNTIME_OBJECT_MISSING); if ((p = BATdescriptor(*rid)) == NULL) { BBPunfix(b->batCacheid); throw(MAL, "bat.inplace", RUNTIME_OBJECT_MISSING); } if ((u = BATdescriptor(*uid)) == NULL) { BBPunfix(b->batCacheid); BBPunfix(p->batCacheid); throw(MAL, "bat.inplace", RUNTIME_OBJECT_MISSING); } if (void_replace_bat(b, p, u, *force) == BUN_NONE) { BBPunfix(b->batCacheid); BBPunfix(p->batCacheid); BBPunfix(u->batCacheid); throw(MAL, "bat.inplace", GDK_EXCEPTION); } BBPkeepref(*r = b->batCacheid); BBPunfix(p->batCacheid); BBPunfix(u->batCacheid); return MAL_SUCCEED; }
char * BKCappend_force_wrap(bat *r, const bat *bid, const bat *uid, const bit *force) { BAT *b, *u; gdk_return ret; if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.append", RUNTIME_OBJECT_MISSING); if ((u = BATdescriptor(*uid)) == NULL) { BBPunfix(b->batCacheid); throw(MAL, "bat.append", RUNTIME_OBJECT_MISSING); } if (BATcount(u) == 0) { ret = GDK_SUCCEED; } else { if ((b = setaccess(b, BAT_WRITE)) == NULL) throw(MAL, "bat.append", OPERATION_FAILED); ret = BATappend(b, u, *force); } BBPunfix(u->batCacheid); if (ret != GDK_SUCCEED) { BBPunfix(b->batCacheid); throw(MAL, "bat.append", GDK_EXCEPTION); } if( b->batPersistence == PERSISTENT) BATmsync(b); BBPkeepref(*r = b->batCacheid); return MAL_SUCCEED; }
str BKCdelete_bat_bun(bat *r, const bat *bid, const bat *sid) { BAT *b, *s; gdk_return ret; if (*bid == *sid) return BKCdelete_all(r, bid); if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.delete", RUNTIME_OBJECT_MISSING); if ((s = BATdescriptor(*sid)) == NULL) { BBPunfix(b->batCacheid); throw(MAL, "bat.delete", RUNTIME_OBJECT_MISSING); } ret = BATdel(b, s, FALSE); BBPunfix(s->batCacheid); if (ret != GDK_SUCCEED) { BBPunfix(b->batCacheid); throw(MAL, "bat.delete_bat_bun", GDK_EXCEPTION); } if( b->batPersistence == PERSISTENT) BATmsync(b); BBPkeepref(*r = b->batCacheid); return MAL_SUCCEED; }
str BKCmirror(bat *ret, const bat *bid) { BAT *b, *bn; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.mirror", RUNTIME_OBJECT_MISSING); } bn = VIEWcombine(b); if (bn != NULL) { if (b->batRestricted == BAT_WRITE) { BAT *bn1; bn1 = BATcopy(bn, bn->htype, bn->ttype, FALSE, TRANSIENT); BBPreclaim(bn); bn = bn1; } if (bn != NULL) { *ret = bn->batCacheid; BBPkeepref(*ret); BBPunfix(b->batCacheid); return MAL_SUCCEED; } } *ret = 0; BBPunfix(b->batCacheid); throw(MAL, "bat.mirror", GDK_EXCEPTION); }
str MATpackValues(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) { int i, type, first = 1; bat *ret; BAT *bn; (void) cntxt; type = getArgType(mb,p,first); bn = BATnew(TYPE_void, type, p->argc, TRANSIENT); if( bn == NULL) throw(MAL, "mat.pack", MAL_MALLOC_FAIL); if (ATOMextern(type)) { for(i = first; i < p->argc; i++) BUNappend(bn, stk->stk[getArg(p,i)].val.pval, TRUE); } else { for(i = first; i < p->argc; i++) BUNappend(bn, getArgReference(stk, p, i), TRUE); } BATseqbase(bn, 0); ret= getArgReference_bat(stk,p,0); BBPkeepref(*ret = bn->batCacheid); return MAL_SUCCEED; }
str MseedLoad(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int *ret0 = (int*) getArgReference(stk,pci,0); int *ret1 = (int*) getArgReference(stk,pci,1); str *targetfile = (str*) getArgReference(stk,pci,2); str msg; BAT *btime, *bdata; (void) cntxt; (void) mb; msg = MseedLoadIntern(&btime, &bdata, *targetfile); if ( msg == MAL_SUCCEED){ BBPkeepref(*ret0 = btime->batCacheid); BBPkeepref(*ret1 = bdata->batCacheid); } return msg; }
/* * Property management * All property operators should ensure exclusive access to the BAT * descriptor. * Where necessary use the primary view to access the properties */ str BKCinfo(bat *ret1, bat *ret2, const bat *bid) { BAT *bk = NULL, *bv= NULL, *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.getInfo", RUNTIME_OBJECT_MISSING); } if (CMDinfo(&bk, &bv, b) == GDK_SUCCEED) { *ret1 = bk->batCacheid; *ret2 = bv->batCacheid; BBPkeepref(bk->batCacheid); BBPkeepref(bv->batCacheid); BBPunfix(*bid); return MAL_SUCCEED; } BBPunfix(*bid); throw(MAL, "BKCinfo", GDK_EXCEPTION); }
str CMDmodules(bat *bid) { BAT *b = TBL_getdir(); if (b) { *bid = b->batCacheid; BBPkeepref(*bid); } return MAL_SUCCEED; }
static void pseudo(bat *ret, BAT *b, str X1,str X2) { char buf[BUFSIZ]; snprintf(buf,BUFSIZ,"%s_%s", X1,X2); if (BBPindex(buf) <= 0) BATname(b,buf); BATroles(b,X1,X2); BATmode(b,TRANSIENT); BATfakeCommit(b); *ret = b->batCacheid; BBPkeepref(*ret); }
str TRNtrans_prev(int *ret, int *bid) { BAT *b,*bn= NULL; b= BATdescriptor(*bid); if (b == NULL) throw(MAL, "transaction.prev", RUNTIME_OBJECT_MISSING); bn = BATprev(b); BBPkeepref(*ret = bn->batCacheid); BBPunfix(b->batCacheid); return MAL_SUCCEED; }
/* * The pack is an ordinary multi BAT insert. Oid synchronistion * between pieces should be ensured by the code generators. * The pack operation could be quite expensive, because it * may create a really large BAT. * The slice over a mat helps to avoid constructing intermediates * that are subsequently reduced. * Contrary to most operations, NIL arguments are skipped and * do not produce RUNTIME_OBJECT_MISSING. */ static str MATpackInternal(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) { int i, *ret = (int*) getArgReference(stk,p,0); BAT *b, *bn; BUN cap = 0; int tt = TYPE_any; (void) cntxt; (void) mb; for (i = 1; i < p->argc; i++) { int bid = stk->stk[getArg(p,i)].val.ival; b = BBPquickdesc(abs(bid),FALSE); if (b && bid < 0) b = BATmirror(b); if( b ){ assert(BAThdense(b)); if (tt == TYPE_any){ tt = b->ttype; } if (!tt && tt != b->ttype) tt = b->ttype; cap += BATcount(b); } } if (tt == TYPE_any){ *ret = 0; return MAL_SUCCEED; } bn = BATnew(TYPE_void, tt, cap, TRANSIENT); if (bn == NULL) throw(MAL, "mat.pack", MAL_MALLOC_FAIL); for (i = 1; i < p->argc; i++) { b = BATdescriptor(stk->stk[getArg(p,i)].val.ival); if( b ){ if (BATcount(bn) == 0) BATseqbase(bn, b->H->seq); if (BATcount(bn) == 0) BATseqbase(BATmirror(bn), b->T->seq); BATappend(bn,b,FALSE); BBPunfix(b->batCacheid); } } assert(!bn->H->nil || !bn->H->nonil); assert(!bn->T->nil || !bn->T->nonil); BATsettrivprop(bn); BATderiveProps(bn,FALSE); BBPkeepref(*ret = bn->batCacheid); return MAL_SUCCEED; }
str BKCsetkey(bat *res, const bat *bid, const bit *param) { BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.setKey", RUNTIME_OBJECT_MISSING); } BATkey(BATmirror(b), *param ? BOUND2BTRUE :FALSE); *res = b->batCacheid; BBPkeepref(b->batCacheid); return MAL_SUCCEED; }
str CMDgetTrace(bat *res, str *ev) { BAT *bn; (void) res; /* fool compiler */ bn = getTrace(*ev); if (bn) { BBPkeepref(*res = bn->batCacheid); return MAL_SUCCEED; } throw(MAL, "getTrace", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING "%s",*ev); }
str GRPsubgroup4(bat *ngid, bat *next, bat *nhis, bat *bid, bat *gid, bat *eid, bat *hid) { BAT *b, *g, *e, *h, *gn, *en, *hn; gdk_return r; b = BATdescriptor(*bid); g = gid ? BATdescriptor(*gid) : NULL; e = eid ? BATdescriptor(*eid) : NULL; h = hid ? BATdescriptor(*hid) : NULL; if (b == NULL || (gid != NULL && g == NULL) || (eid != NULL && e == NULL) || (hid != NULL && h == NULL)) { if (g) BBPreleaseref(g->batCacheid); if (e) BBPreleaseref(e->batCacheid); if (h) BBPreleaseref(h->batCacheid); throw(MAL, "group.subgroup", RUNTIME_OBJECT_MISSING); } if ((r = BATgroup(&gn, &en, &hn, b, g, e, h)) == GDK_SUCCEED) { *ngid = gn->batCacheid; *next = en->batCacheid; *nhis = hn->batCacheid; BBPkeepref(*ngid); BBPkeepref(*next); BBPkeepref(*nhis); } BBPreleaseref(b->batCacheid); if (g) BBPreleaseref(g->batCacheid); if (e) BBPreleaseref(e->batCacheid); if (h) BBPreleaseref(h->batCacheid); return r == GDK_SUCCEED ? MAL_SUCCEED : createException(MAL, "group.subgroup", GDK_EXCEPTION); }
str BKCnewBAT(bat *res, const int *ht, const int *tt, const BUN *cap, int role) { BAT *bn; bn = BATnew(*ht == TYPE_oid ? TYPE_void : *ht, *tt, *cap, role); if (bn == NULL) throw(MAL, "bat.new", GDK_EXCEPTION); if (*ht == TYPE_oid) BATseqbase(bn, 0); *res = bn->batCacheid; BBPkeepref(*res); return MAL_SUCCEED; }
str BKCattach(bat *ret, const int *tt, const char * const *heapfile) { BAT *bn; bn = BATattach(*tt, *heapfile, TRANSIENT); if (bn == NULL) throw(MAL, "bat.attach", GDK_EXCEPTION); if( bn->batPersistence == PERSISTENT) BATmsync(bn); *ret = bn->batCacheid; BBPkeepref(*ret); return MAL_SUCCEED; }
str BKCreverse(bat *ret, const bat *bid) { BAT *b, *bn = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.reverse", RUNTIME_OBJECT_MISSING); } bn = BATmirror(b); /* bn inherits ref from b */ assert(bn != NULL); *ret = bn->batCacheid; BBPkeepref(bn->batCacheid); return MAL_SUCCEED; }
str BKCbun_inplace_force(bat *r, const bat *bid, const oid *id, const void *t, const bit *force) { BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.inplace", RUNTIME_OBJECT_MISSING); if (void_inplace(b, *id, t, *force) != GDK_SUCCEED) { BBPunfix(b->batCacheid); throw(MAL, "bat.inplace", GDK_EXCEPTION); } BBPkeepref(*r = b->batCacheid); return MAL_SUCCEED; }
str db_users_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { bat *r = getArgReference_bat(stk, pci, 0); BAT *uid, *nme; str err; (void) mb; if ((err = AUTHgetUsers(&uid, &nme, cntxt)) != MAL_SUCCEED) return err; BBPunfix(uid->batCacheid); *r = nme->batCacheid; BBPkeepref(*r); return MAL_SUCCEED; }