Changeset: adca2ffdf700 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=adca2ffdf700
Modified Files:
sql/backends/monet5/sql.mx
Branch: default
Log Message:
Merge with Apr2011 branch.
diffs (truncated from 767 to 300 lines):
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -2355,8 +2355,10 @@
for (i=0; i<m->topvars && m->vars[i].s; i++)
BUNappend(vars, m->vars[i].name, FALSE);
r = BATnew(TYPE_str,TYPE_bat,1);
- if( r == NULL)
+ if( r == NULL){
+ BBPreleaseref(vars->batCacheid);
throw(SQL, "sql.variables", MAL_MALLOC_FAIL);
+ }
BUNins(r, "name", &vars->batCacheid, FALSE);
BBPunfix(vars->batCacheid);
*res = r->batCacheid;
@@ -2781,10 +2783,10 @@
ins = *(ptr*)ins;
s = mvc_bind_schema(m, sname);
if ( s == NULL)
- throw(MAL,"sql.append","Schema missing");
+ throw(SQL,"sql.append","Schema missing");
t = mvc_bind_table(m, s, tname);
if ( t == NULL)
- throw(MAL,"sql.append","Table missing");
+ throw(SQL,"sql.append","Table missing");
if (tpe == TYPE_bat)
BATaccessBegin((BAT*)ins, USE_ALL, MMAP_SEQUENTIAL);
c = mvc_bind_column(m, t, cname);
@@ -2827,10 +2829,10 @@
ins = *(ptr*)ins;
s = mvc_bind_schema(m, sname);
if ( s == NULL)
- throw(MAL,"sql.update","Schema missing");
+ throw(SQL,"sql.update","Schema missing");
t = mvc_bind_table(m, s, tname);
if ( t == NULL)
- throw(MAL,"sql.update","Table missing");
+ throw(SQL,"sql.update","Table missing");
if (tpe == TYPE_bat)
BATaccessBegin((BAT*)ins, USE_ALL, MMAP_SEQUENTIAL);
c = mvc_bind_column(m, t, cname);
@@ -2947,10 +2949,10 @@
return msg;
s = mvc_bind_schema(m, *sname);
if ( s == NULL)
- throw(MAL,"sql.clear_table","Schema missing");
+ throw(SQL,"sql.clear_table","Schema missing");
t = mvc_bind_table(m, s, *tname);
if ( t == NULL)
- throw(MAL,"sql.clear_table","Table missing");
+ throw(SQL,"sql.clear_table","Table missing");
*res = mvc_clear_table(m, t);
return MAL_SUCCEED;
}
@@ -2981,10 +2983,10 @@
throw(SQL, "sql.delete","Cannot access descriptor");
s = mvc_bind_schema(m, sname);
if ( s == NULL)
- throw(MAL,"sql.delete","Schema missing");
+ throw(SQL,"sql.delete","Schema missing");
t = mvc_bind_table(m, s, tname);
if ( t == NULL)
- throw(MAL,"sql.delete","Table missing");
+ throw(SQL,"sql.delete","Table missing");
store_funcs.delete_tab(m->session->tr, t, b, tpe);
if (tpe == TYPE_bat)
BBPunfix(((BAT*)ins)->batCacheid);
@@ -3163,7 +3165,7 @@
return msg;
s = mvc_bind_schema(m, dt_schema);
if ( s == NULL)
- throw(MAL,"sql.declared_table","Schema missing");
+ throw(SQL,"sql.declared_table","Schema missing");
(void)mvc_create_table(m, s, *name, tt_table, TRUE, SQL_DECLARED_TABLE,
CA_DROP, 0);
*res_id = 0;
return MAL_SUCCEED;
@@ -3195,10 +3197,10 @@
throw(SQL, "sql.dtColumn", "Cannot find column type");
s = mvc_bind_schema(m, dt_schema);
if ( s == NULL)
- throw(MAL,"sql.declared_table_column","Schema missing");
+ throw(SQL,"sql.declared_table_column","Schema missing");
t = mvc_bind_table(m, s, *tname);
if ( t == NULL)
- throw(MAL,"sql.declared_table_column","Table missing");
+ throw(SQL,"sql.declared_table_column","Table missing");
(void)mvc_create_column(m, t, *name, &tpe);
*ret = 0;
return MAL_SUCCEED;
@@ -3217,10 +3219,10 @@
return msg;
s = mvc_bind_schema(m, dt_schema);
if ( s == NULL)
- throw(MAL,"sql.drop","Schema missing");
+ throw(SQL,"sql.drop","Schema missing");
t = mvc_bind_table(m, s, *name);
if ( t == NULL)
- throw(MAL,"sql.drop","Table missing");
+ throw(SQL,"sql.drop","Table missing");
(void)mvc_drop_table(m, s, t, 0);
return MAL_SUCCEED;
}
@@ -3238,7 +3240,7 @@
return msg;
s = mvc_bind_schema(m, dt_schema);
if ( s == NULL)
- throw(MAL,"sql.drop","Schema missing");
+ throw(SQL,"sql.drop","Schema missing");
while(i && s->tables.set->t) {
t = s->tables.set->t->data;
(void)mvc_drop_table(m, s, t, 0);
@@ -3458,7 +3460,7 @@
return msg;
if ( s == NULL)
- throw(MAL,"sql.drop","Schema missing");
+ throw(SQL,"sql.drop","Schema missing");
t = mvc_bind_table(m, s, tname);
if (!t)
throw(SQL,"sql", "table %s not found", tname);
@@ -3606,16 +3608,20 @@
assert(b->htype == TYPE_oid);
if (BATtkey(b) || BATtdense(b) || BATcount(b) <= 1) {
bn = BATnew(TYPE_oid, TYPE_oid, 0);
- if( bn == NULL)
+ if( bn == NULL) {
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.not_uniques", MAL_MALLOC_FAIL);
+ }
} else if (b->tsorted&1) { /* ugh handle both wrd and oid types */
oid c = *(oid*)Tloc(b, BUNfirst(b)), *rf, *rh, *rt;
oid *h = (oid*)Hloc(b,0), *vp, *ve;
int first = 1;
bn = BATnew(TYPE_oid, TYPE_oid, BATcount(b));
- if( bn == NULL)
+ if( bn == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.not_uniques", MAL_MALLOC_FAIL);
+ }
vp = (oid*)Tloc(b, BUNfirst(b));
ve = vp + BATcount(b);
rf = rh = (oid*)Hloc(bn, BUNfirst(bn));
@@ -3649,10 +3655,10 @@
if (BATprepareHash(bm))
throw(SQL, "not_uniques", "hash creation failed");
bn = BATnew(TYPE_oid, TYPE_oid, BATcount(b));
- if( bn == NULL)
- throw(SQL, "sql.not_uniques", MAL_MALLOC_FAIL);
- if( bn == NULL)
+ if( bn == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.unique_oids", MAL_MALLOC_FAIL);
+ }
vp = (oid*)Tloc(b, BUNfirst(b));
ve = vp + BATcount(b);
rf = rh = (oid*)Hloc(bn, BUNfirst(bn));
@@ -3821,8 +3827,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.dec_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -3852,8 +3860,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.num_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -3995,8 +4005,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.2_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -4113,8 +4125,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_str, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.str_cast", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -4157,8 +4171,10 @@
throw(SQL, "batcalc.@2_2_@1", "Cannot access descriptor");
}
bn = BATnew(TYPE_void, TYPE_@1, BATcount(b));
- if( bn == NULL)
+ if( bn == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.@2_2_@1", MAL_MALLOC_FAIL);
+ }
bn->hsorted = b->hsorted;
BATseqbase(bn, b->hseqbase);
o = (@1*) Tloc(bn,BUNfirst(bn));
@@ -4232,8 +4248,10 @@
throw(SQL, "batcalc.@2_2_@1", "Cannot access descriptor");
}
bn = BATnew(TYPE_void, TYPE_@1, BATcount(b));
- if( bn == NULL)
+ if( bn == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.@2_2_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(bn, b->hseqbase);
bn->H->nonil = 1;
bn->T->nonil = 1;
@@ -4369,8 +4387,10 @@
throw(SQL, "batcalc.@2_dec2_@1", "Cannot access descriptor");
}
bn = BATnew(TYPE_void, TYPE_@1, BATcount(b));
- if( bn == NULL)
+ if( bn == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.dec2_@1", MAL_MALLOC_FAIL);
+ }
bn->hsorted = b->hsorted;
BATseqbase(bn, b->hseqbase);
o = (@1*) Tloc(bn,BUNfirst(bn));
@@ -4429,8 +4449,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.dec2dec_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -4458,8 +4480,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.num2dec_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -4543,8 +4567,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.num2dec_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_TAIL, MMAP_SEQUENTIAL);
BATloop(b,p,q) {
@@ -4651,8 +4677,10 @@
throw(SQL, "batcalc.@2_dec2_@1", "Cannot access descriptor");
}
bn = BATnew(TYPE_void, TYPE_@1, BATcount(b));
- if( bn == NULL)
+ if( bn == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.dec2_@1", MAL_MALLOC_FAIL);
+ }
bn->hsorted = b->hsorted;
BATseqbase(bn, b->hseqbase);
o = (@1*) Tloc(bn,BUNfirst(bn));
@@ -4704,8 +4732,10 @@
}
bi = bat_iterator(b);
dst = BATnew(b->htype, TYPE_@1, BATcount(b));
- if( dst == NULL)
+ if( dst == NULL){
+ BBPreleaseref(b->batCacheid);
throw(SQL, "sql.dec2dec_@1", MAL_MALLOC_FAIL);
+ }
BATseqbase(dst, b->hseqbase);
BATaccessBegin(b, USE_TAIL, MMAP_SEQUENTIAL);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list