Update of /cvsroot/monetdb/sql/src/storage/bat
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22113/src/storage/bat

Modified Files:
        bat_storage.mx 
Log Message:
fixed 2 bugs in storage 
        1) savepoints need to copy the insert bat (ibat) to the delta's 
                bat field (ie we need to keep new delta's)
        2) updates on inserts should move into the ibat.



U bat_storage.mx
Index: bat_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_storage.mx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- bat_storage.mx      7 Jan 2009 14:19:29 -0000       1.33
+++ bat_storage.mx      17 Jan 2009 18:17:01 -0000      1.34
@@ -183,8 +183,20 @@
        BAT *b;
 
        if (!is_new && bat->ubid) {
-               b = temp_descriptor(bat->ubid);
+               BAT *ib = temp_descriptor(bat->ibid), *u = upd;
+
+               if (BATcount(ib)) { 
+                       BAT *b = temp_descriptor(bat->bid);
+                       BAT *updins, *updcur;
+
+                       updins = BATsemijoin(upd, ib);
+                       void_replace_bat(ib, updins, TRUE);
+                       bat_destroy(updins);
+                       updcur = BATsemijoin(upd, b);
+                       u = updcur;
+               }
 
+               b = temp_descriptor(bat->ubid);
                assert(b);
                if (isEUbat(b)){
                        temp_destroy(bat->ubid);
@@ -193,16 +205,18 @@
                        b = temp_descriptor(bat->ubid);
                }
                BATkey(b, BOUND2BTRUE);
-               BATins(b, upd, TRUE);
+               BATins(b, u, TRUE);
+               if (upd != u)
+                       bat_destroy(u);
        } else if (is_new && bat->bid) { 
                BAT *ib = temp_descriptor(bat->ibid);
                b = temp_descriptor(bat->bid);
                if (BATcount(ib)) { 
                        BAT *updins, *updcur;
-                       updins = BATkdiff(upd, ib);
+                       updins = BATsemijoin(upd, ib);
                        void_replace_bat(ib, updins, TRUE);
                        bat_destroy(updins);
-                       updcur = BATkdiff(upd, b);
+                       updcur = BATsemijoin(upd, b);
                        void_replace_bat(b, updcur, TRUE);
                        bat_destroy(updins);
                } else {
@@ -824,6 +838,12 @@
                                /* new cols are moved to gtrans and bat.bid */
                                temp_dup(bat->ibid);
                                obat->bid = bat->ibid;
+                       } else if (!c_isnew) {  
+                               bat->bid = bat->ibid;
+
+                               b = bat_new(TYPE_void, type, sz);
+                               bat_set_access(b, BAT_READ);
+                               bat->ibid = temp_create(b);
                        }
                        if (obat->bid) {
                                BAT *cb = temp_descriptor(obat->bid);


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to