Changeset: 8f84c3c53457 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f84c3c53457
Modified Files:
monetdb5/extras/jaql/Tests/json00.mal
monetdb5/extras/jaql/Tests/json00.stable.out
monetdb5/extras/jaql/json.c
Branch: Oct2012
Log Message:
drop: try harder to get rid of stored BATs
Dropping a BAT to transient, or caaling BATdelete doesn't result in the
desired effect of the BAT being gone, or at least no longer retrievable
through its former name. Renaming a BAT to avoid it being available
under its old name turned out to be impossible too. Hence, use BBPclear
to remove the BAT the hard way.
Changed json00 test to check the dropped object is no longer available
(like it used to be before this commit).
diffs (117 lines):
diff --git a/monetdb5/extras/jaql/Tests/json00.mal
b/monetdb5/extras/jaql/Tests/json00.mal
--- a/monetdb5/extras/jaql/Tests/json00.mal
+++ b/monetdb5/extras/jaql/Tests/json00.mal
@@ -23,3 +23,9 @@ json.store("demo", j1,j2,j3,j4,j5,j6,j7)
json.print(s, i1,i2,i3,i4,i5,i6,i7);
json.drop("demo");
+# this should no longer exist
+(i1,i2,i3,i4,i5,i6,i7) := json.load("demo");
+catch MALException:str;
+ io.printf("!%s\n", MALException);
+exit MALException;
+
diff --git a/monetdb5/extras/jaql/Tests/json00.stable.out
b/monetdb5/extras/jaql/Tests/json00.stable.out
--- a/monetdb5/extras/jaql/Tests/json00.stable.out
+++ b/monetdb5/extras/jaql/Tests/json00.stable.out
@@ -35,6 +35,11 @@ exit MALException:str ;
(i1,i2,i3,i4,i5,i6,i7) := json.load("demo");
json.print(s,i1,i2,i3,i4,i5,i6,i7);
json.drop("demo");
+# this should no longer exist
+ (i1,i2,i3,i4,i5,i6,i7) := json.load("demo");
+catch MALException:str ;
+ io.printf("!%s\n",MALException);
+exit MALException:str ;
end main;
[ 1, 3, 5 ]
[ "hello", "world" ]
@@ -42,6 +47,7 @@ end main;
[ { "from": 101, "to": [ 20, 81, 94 ], "ts": 1234567, "msg": "Hello world!" } ]
!MALException:json.store:no such JSON object with name: demo
[ { "from": 101, "to": [ 20, 81, 94 ], "ts": 1234567, "msg": "Hello world!" } ]
+!MALException:json.store:no such JSON object with name: demo
# 11:20:37 >
# 11:20:37 > "Done."
diff --git a/monetdb5/extras/jaql/json.c b/monetdb5/extras/jaql/json.c
--- a/monetdb5/extras/jaql/json.c
+++ b/monetdb5/extras/jaql/json.c
@@ -1046,9 +1046,6 @@ JSONdrop(int *ret, str *name)
{
char buf[256];
int bid;
- BAT *t;
- bat blist[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- int bcnt = 1;
snprintf(buf, sizeof(buf), "json_%s_kind", *name);
bid = BBPindex(buf);
@@ -1056,54 +1053,32 @@ JSONdrop(int *ret, str *name)
throw(MAL, "json.drop",
"no such JSON object with name: %s", *name);
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
+ BBPclear(bid);
snprintf(buf, sizeof(buf), "json_%s_string", *name);
bid = BBPindex(buf);
- if (bid) {
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
- }
+ if (bid)
+ BBPclear(bid);
snprintf(buf, sizeof(buf), "json_%s_integer", *name);
bid = BBPindex(buf);
- if (bid) {
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
- }
+ if (bid)
+ BBPclear(bid);
snprintf(buf, sizeof(buf), "json_%s_doble", *name);
bid = BBPindex(buf);
- if (bid) {
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
- }
+ if (bid)
+ BBPclear(bid);
snprintf(buf, sizeof(buf), "json_%s_array", *name);
bid = BBPindex(buf);
- if (bid) {
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
- }
+ if (bid)
+ BBPclear(bid);
snprintf(buf, sizeof(buf), "json_%s_object", *name);
bid = BBPindex(buf);
- if (bid) {
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
- }
+ if (bid)
+ BBPclear(bid);
snprintf(buf, sizeof(buf), "json_%s_name", *name);
bid = BBPindex(buf);
- if (bid) {
- t = BBPquickdesc(ABS(bid), FALSE);
- BATmode(t, TRANSIENT);
- blist[bcnt++] = ABS(bid);
- }
-
- TMsubcommit_list(blist, bcnt);
+ if (bid)
+ BBPclear(bid);
*ret = 0;
return MAL_SUCCEED;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list