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

Modified Files:
        bat_storage.mx 
Log Message:
algebra now has insert,update and delete operators.
mostly code moved from sql_updates.mx into rel_bin.mx
In the process, within functions we no longer output 'rows affected' 
results of insert, update and deletes.

alter table use update instead insert now (column/idx bat with default
values is generated by the storage layer).

create user, now uses the table_funcs interface 
same holds for granting and revoking privileges on tables.
This was needed to remove dependency on old insert/delete code.


U bat_storage.mx
Index: bat_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_storage.mx,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- bat_storage.mx      25 Nov 2008 22:19:49 -0000      1.27
+++ bat_storage.mx      21 Dec 2008 19:38:22 -0000      1.28
@@ -616,12 +616,28 @@
        } else if (bat->ibid) { /* create bats for a new persistent idx */
                return new_persistent_bat( tr, ni->data, ni->t->sz);
        } else if (!bat->ibid) {
-               BAT *b = bat_new(TYPE_void, type, ni->t->sz);
+               sql_column *c = ni->t->columns.set->h->data;
+               /* Here we also handle indices created through alter stmts */
+               /* These need to be created aligned to the existing data */
+               //BAT *b = bat_new(TYPE_void, type, ni->t->sz);
+               BAT *b, *cb = bind_col(tr, c, RDONLY);
+               if (type == TYPE_wrd) {
+                       wrd val = 0;
+                       b = BATconst(cb, type, &val);
+               } else {
+                       oid val = 0;
+                       b = BATconst(cb, type, &val);
+               }
+               bat_destroy(cb);
                if (!b) 
                        return LOG_ERR;
-               bat_set_access(b, BAT_READ);
-               bat->ibid = temp_create(b);
+               /* a copy because BATconst may return a view */
+               cb = BATcopy(b, TYPE_void, b->ttype, TRUE);
                bat_destroy(b);
+               bat_set_access(cb, BAT_READ);
+               bat->cnt = BATcount(cb);
+               bat->ibid = temp_create(cb);
+               bat_destroy(cb);
        }
        return ok;
 }


------------------------------------------------------------------------------
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to