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; }
static BAT * delta_full_bat_( sql_column *c, sql_delta *bat, int temp) { /* return full normalized column bat * b := b.copy() b := b.append(i); b := b.replace(u); */ BAT *r, *b, *ui, *uv, *i = temp_descriptor(bat->ibid); int needcopy = 1; if (!i) return NULL; r = i; if (temp) return r; b = temp_descriptor(bat->bid); if (!b) { b = i; } else { if (BATcount(i)) { r = COLcopy(b, b->ttype, true, TRANSIENT); bat_destroy(b); if (r == NULL) { bat_destroy(i); return NULL; } b = r; if (BATappend(b, i, NULL, true) != GDK_SUCCEED) { bat_destroy(b); bat_destroy(i); return NULL; } needcopy = 0; } bat_destroy(i); } if (bat->uibid && bat->ucnt) { ui = temp_descriptor(bat->uibid); uv = temp_descriptor(bat->uvbid); if (ui && BATcount(ui)) { if (needcopy) { r = COLcopy(b, b->ttype, true, TRANSIENT); bat_destroy(b); b = r; if(b == NULL) { bat_destroy(ui); bat_destroy(uv); return NULL; } } if (void_replace_bat(b, ui, uv, true) != GDK_SUCCEED) { bat_destroy(ui); bat_destroy(uv); bat_destroy(b); return NULL; } } bat_destroy(ui); bat_destroy(uv); } (void)c; if (!store_initialized && !bat->cached) bat->cached = b; return b; }