📄 bat5.c
字号:
#line 1902 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1903 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" if (BUNreplace(b, h, t, 0) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.replace", "BUNreplaceFailed"); } BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCreplace_bat(int *r, int *bid, int *sid){ BAT *b, *s; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.replace", "Cannot access descriptor"); } if ((s = BATdescriptor(*sid)) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.replace", "Cannot access descriptor"); } if (BATreplace(b, s, 0) != NULL) { BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); throw(MAL, "bat.replace_bat", "GDKerror");}strBKCreplace_bun_force(int *r, int *bid, ptr h, ptr t, bit *force){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.replace", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->htype >= TYPE_str && ATOMstorage(b->htype) >= TYPE_str) { if(h== 0 || *(str*)h==0) h = (str)str_nil; else h = *(str *)h; }}#line 1944 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1945 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" if (BUNreplace(b, h, t, *force) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.replace", "BUNreplaceFailed"); } BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCreplace_bat_force(int *r, int *bid, int *sid, bit *force){ BAT *b, *s; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.replace", "Cannot access descriptor"); } if ((s = BATdescriptor(*sid)) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.replace", "Cannot access descriptor"); } if (BATreplace(b, s, *force) != NULL) { BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); throw(MAL, "bat.replace_bat", "GDKerror");}char *BKCdelete_bun(int *r, int *bid, ptr h, ptr t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.delete", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->htype >= TYPE_str && ATOMstorage(b->htype) >= TYPE_str) { if(h== 0 || *(str*)h==0) h = (str)str_nil; else h = *(str *)h; }}#line 1986 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1987 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" if (BUNdel(b, h, t,FALSE) != NULL) { BBPreleaseref(b->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); throw(MAL, "bat.delete_buns", "GDKerror");}char *BKCdelete(int *r, int *bid, ptr h){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.delete", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->htype >= TYPE_str && ATOMstorage(b->htype) >= TYPE_str) { if(h== 0 || *(str*)h==0) h = (str)str_nil; else h = *(str *)h; }}#line 2005 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" if (BUNdelHead(b, h,FALSE) != NULL) { BBPreleaseref(b->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); throw(MAL, "bat.delete", "GDKerror");}strBKCdelete_all(int *r, int *bid){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.delete", "Cannot access descriptor"); } if (BATclear(b) != NULL) { BBPreleaseref(b->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); throw(MAL, "bat.delete", "GDKerror");}strBKCdelete_bat_bun(int *r, int *bid, int *sid){ BAT *b, *s; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.delete", "Cannot access descriptor"); } if ((s = BATdescriptor(*sid)) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.delete", "Cannot access descriptor"); } if (BATdel(b, s,FALSE) != NULL) { BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); throw(MAL, "bat.delete_bat_buns", "GDKerror");}strBKCdelete_bat(int *r, int *bid, int *sid){ BAT *b, *s; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.delete", "Cannot access descriptor"); } if ((s = BATdescriptor(*sid)) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.delete", "Cannot access descriptor"); } if (BATdelHead(b, s,FALSE) != NULL) { BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); throw(MAL, "bat.delete_bats", "GDKerror");}strBKCdestroy_bat(bit *r, str *input){ CMDdestroy(r, *input); return MAL_SUCCEED;}char *BKCdestroyImmediate(signed char*r, int *bid){ BAT *b; char buf[512]; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.destroy", "Cannot access descriptor"); } BBPlogical(b->batCacheid, buf); BBPreleaseref(b->batCacheid); CMDdestroy(r, buf); return MAL_SUCCEED;}char *BKCdestroy(signed char *r, int *bid){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.destroy", "Cannot access descriptor"); } *bid = 0; BATmode(b, TRANSIENT); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}/* The SQL frontend uses void-head bats */size_tvoid_delete_bat(BAT *b, BAT *d, int delta){ size_t nr = 0; BUN r, s; ptr nil = ATOMnilptr(b->ttype); if (delta) { for (r = d->batInserted; r < BUNlast(d); r = BUNnext(d, r)) { oid delid = *(oid *) BUNtail(d, r); void_inplace5(b, delid, nil, TRUE); nr++; } } else { BATloop(d, r, s) { oid delid = *(oid *) BUNtail(d, r); void_inplace5(b, delid, nil, TRUE); nr++; } } return nr;}size_tvoid_insert_delta(BAT *b, BAT *u){ size_t nr = 0; BUN r; for (r = u->batInserted; r < BUNlast(u); r = BUNnext(u, r)) { BUNappend(b, BUNtail(u, r),FALSE); nr++; } return nr;}size_tvoid_replace_delta(BAT *b, BAT *u){ size_t nr = 0; BUN r; for (r = u->batInserted; r < BUNlast(u); r = BUNnext(u, r)) { oid updid = *(oid *) BUNhead(u, r); ptr val = BUNtail(u, r); void_inplace5(b, updid, val, TRUE); nr++; } return nr;}char *BKCappend_wrap(int *r, int *bid, int *uid){ BAT *i, *u; (void) r; if ((i = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.append", "Cannot access descriptor"); } if ((u = BATdescriptor(*uid)) == NULL) { BBPreleaseref(i->batCacheid); throw(MAL, "bat.append", "Cannot access descriptor"); } BATappend(i, u,FALSE); BBPreleaseref(i->batCacheid); BBPreleaseref(u->batCacheid); return MAL_SUCCEED;}strBKCappend_val_wrap(int *r, int *bid, ptr u){ BAT *i; (void) r; if ((i = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.append", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( i->ttype >= TYPE_str && ATOMstorage(i->ttype) >= TYPE_str) { if(u== 0 || *(str*)u==0) u = (str)str_nil; else u = *(str *)u; }}#line 2198 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNappend(i, u,FALSE); BBPreleaseref(i->batCacheid); return MAL_SUCCEED;}strBKCappend_reverse_val_wrap(int *r, int *bid, ptr u){ BAT *i; (void) r; if ((i = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.append", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( i->ttype >= TYPE_str && ATOMstorage(i->ttype) >= TYPE_str) { if(u== 0 || *(str*)u==0) u = (str)str_nil; else u = *(str *)u; }}#line 2213 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNappend(BATmirror(i), u,FALSE); BBPreleaseref(i->batCacheid); return MAL_SUCCEED;}char *BKCappend_force_wrap(int *r, int *bid, int *uid, bit *force){ BAT *i, *u; (void) r; if ((i = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.append", "Cannot access descriptor"); } if ((u = BATdescriptor(*uid)) == NULL) { BBPreleaseref(i->batCacheid); throw(MAL, "bat.append", "Cannot access descriptor"); } BATappend(i, u, *force); BBPreleaseref(i->batCacheid); BBPreleaseref(u->batCacheid); return MAL_SUCCEED;}strBKCappend_val_force_wrap(int *r, int *bid, ptr u, bit *force){ BAT *i; (void) r; if ((i = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.append", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( i->ttype >= TYPE_str && ATOMstorage(i->ttype) >= TYPE_str) { if(u== 0 || *(str*)u==0) u = (str)str_nil; else u = *(str *)u; }}#line 2248 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNappend(i, u, *force); BBPreleaseref(i->batCacheid); return MAL_SUCCEED;}str BKCbun_inplace(int *r, int *bid, oid *id, ptr t){ BAT *o; (void) r; if ((o = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.inplace", "Cannot access descriptor"); } void_inplace5(o, *id, t,FALSE); BBPreleaseref(o->batCacheid); return MAL_SUCCEED;}str BKCbun_inplace_force(int *r, int *bid, oid *id, ptr t, bit *force){ BAT *o; (void) r; if ((o = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.inplace", "Cannot access descriptor"); } void_inplace5(o, *id, t, *force); BBPreleaseref(o->batCacheid); return MAL_SUCCEED;}strBKCbat_inplace(int *r, int *bid, int *rid){ BAT *o, *d; (void) r; if ((o = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.inplace", "Cannot access descriptor"); } if ((d = BATdescriptor(*rid)) == NULL) { BBPreleaseref(o->batCacheid); throw(MAL, "bat.inplace", "Cannot access descriptor"); } void_replace_bat5(o, d,FALSE); BBPreleaseref(o->batCacheid); BBPreleaseref(d->batCacheid); return MAL_SUCCEED;}strBKCbat_inplace_force(int *r, int *bid, int *rid, bit *force){ BAT *o, *d; (void) r; if ((o = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.inplace", "Cannot access descriptor"); } if ((d = BATdescriptor(*rid)) == NULL) { BBPreleaseref(o->batCacheid); throw(MAL, "bat.inplace", "Cannot access descriptor"); } void_replace_bat5(o, d, *force); BBPreleaseref(o->batCacheid); BBPreleaseref(d->batCacheid); return MAL_SUCCEED;}/*end of SQL enhancement */char *BKCgetAlpha(int *r, int *bid){ BAT *b, *c; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.getInserted", "Cannot access descriptor"); } c = BATalpha(b); *r = c->batCacheid; BBPkeepref(c->batCacheid); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}char *BKCgetDelta(int *r, int *bid){ BAT *b, *c; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.getDeleted", "Cannot access descriptor"); } c = BATdelta(b); *r = c->batCacheid; BBPkeepref(c->batCacheid); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCgetCapacity(lng *res, int *bid){ CMDcapacity(res, bid); return MAL_SUCCEED;}strBKCgetHeadType(str *res, int *bid){ CMDhead(res, bid); return MAL_SUCCEED;}strBKCgetTailType(str *res, int *bid){ CMDtail(res, bid); return MAL_SUCCEED;}strBKCgetRole(str *res, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.getType", "Cannot access descriptor"); } *res = GDKstrdup((*bid > 0) ? b->hident : b->tident); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCsetkey(int *res, int *bid, bit *param){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.setKey", "Cannot access descriptor"); } BATkey(b, *param ? BOUND2BTRUE :FALSE); *res = b->batCacheid; BBPkeepref(b->batCacheid); return MAL_SUCCEED;}strBKCsetSet(int *res, int *bid, bit *param){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.setSet", "Cannot access descriptor"); } BATset(b, *param ? BOUND2BTRUE :FALSE); *res = b->batCacheid; BBPkeepref(b->batCacheid); return MAL_SUCCEED;}strBKCisaSet(int *res, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.isaSet", "Cannot access descriptor"); } *res = b->batSet; BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCsetSorted(bit *res, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.isSorted", "Cannot access descriptor"); } CMDordered(res, b); *res = BATordered(b) ? 1 : 0; BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCisSorted(bit *res, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.isSorted", "Cannot access descriptor"); } *res = BATordered(b) ? 1 : 0; BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCisSortedReverse(bit *res, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.isSorted", "Cannot access descriptor"); } *res = BATordered_rev(b) ? 1 : 0; BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -