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

Modified Files:
      Tag: Aug2009
        restrict_storage.mx restrict_table.mx 
Log Message:

In an attampt to ensure portability to, and hence correctness on,
64-bit big-endian machines with 32-bit OIDs,
we make the SQL storage interface implementation a bit "less generic",
but a bit "more MonetDB-specific",
by using type oid instead of type ssize_t
for row indices / row ids ("rid")
that are stored as type oid in BATs.

(For convenience, these changes are wrapped in CVS tags
 "rid-ssize_t" & "rid-oid".)


U restrict_table.mx
Index: restrict_table.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/restrict/restrict_table.mx,v
retrieving revision 1.4.6.1
retrieving revision 1.4.6.2
diff -u -d -r1.4.6.1 -r1.4.6.2
--- restrict_table.mx   4 Aug 2009 22:15:24 -0000       1.4.6.1
+++ restrict_table.mx   12 Aug 2009 11:25:37 -0000      1.4.6.2
@@ -57,13 +57,13 @@
        return b;
 }
 
-static ssize_t
+static oid
 column_find_row(sql_trans *tr, sql_column *c, void *value, ...)
 {
        va_list va;
        BUN q;
        BAT *b = NULL, *s = NULL, *r = NULL, *d = NULL;
-       ssize_t rid = -1;
+       oid rid = oid_nil;
        sql_column *nc;
        void *nv;
        sql_bat *bat = c->t->data;
@@ -99,7 +99,7 @@
 }
 
 static void *
-column_find_value(sql_trans *tr, sql_column *c, ssize_t rid)
+column_find_value(sql_trans *tr, sql_column *c, oid rid)
 {
        BUN q;
        BAT *b, *d = NULL;
@@ -129,10 +129,9 @@
 }
 
 static int
-column_update_value(sql_trans *tr, sql_column *c, ssize_t rid, void *value)
+column_update_value(sql_trans *tr, sql_column *c, oid rid, void *value)
 {
-       assert(rid != (ssize_t)oid_nil);
-       assert(rid != -1);
+       assert(rid != oid_nil);
 
        store_funcs.update_col(tr, c, value, c->type.type->localtype, rid);
        return 0;
@@ -162,10 +161,9 @@
 }
 
 static int
-table_delete(sql_trans *tr, sql_table *t, ssize_t rid)
+table_delete(sql_trans *tr, sql_table *t, oid rid)
 {
-       assert(rid != (ssize_t)oid_nil);
-       assert(rid != -1);
+       assert(rid != oid_nil);
 
        store_funcs.delete_tab(tr, t, &rid, TYPE_oid);
        return 0;
@@ -244,15 +242,15 @@
 }
 
 
-/* return table rids from result of rids_select, return (-1) when done */
-static ssize_t 
+/* return table rids from result of rids_select, return (oid_nil) when done */
+static oid 
 rids_next(rids *r)
 {
        if (r->cur < BATcount(r->data)) {
                BATiter bi = bat_iterator(r->data);
                return *(oid*)BUNhead(bi, r->cur++);
        }
-       return -1;
+       return oid_nil;
 }
 
 static rids *

U restrict_storage.mx
Index: restrict_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/restrict/restrict_storage.mx,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -u -d -r1.16.2.1 -r1.16.2.2
--- restrict_storage.mx 4 Aug 2009 22:15:24 -0000       1.16.2.1
+++ restrict_storage.mx 12 Aug 2009 11:25:37 -0000      1.16.2.2
@@ -126,12 +126,11 @@
 }
 
 static void
-update_val( sql_bat *bat, ssize_t rid, void *upd, int isnew) 
+update_val( sql_bat *bat, oid rid, void *upd, int isnew) 
 {
        BAT *b;
 
-       assert(rid != (ssize_t)oid_nil);
-       assert(rid != -1);
+       assert(rid != oid_nil);
        b = temp_descriptor(bat->bid);
        if (!isnew) {
                BAT *u = NULL;
@@ -152,18 +151,18 @@
                }
                bat_destroy(u);
        }
-       assert(rid > 0);
+       assert(rid != oid_nil);
 #if SIZEOF_OID < SIZEOF_SSIZE_T
        assert((lng) rid <= (lng) GDK_oid_max);
 #endif
-       void_inplace(b, (oid)rid, upd, TRUE);
+       void_inplace(b, rid, upd, TRUE);
        bat_destroy(b);
 }
 
 /* for now we simply apply the updates, problem is we can't rollback */
 
 static void
-update_col(sql_trans *tr, sql_column *c, void *i, int tpe, ssize_t rid)
+update_col(sql_trans *tr, sql_column *c, void *i, int tpe, oid rid)
 {
        sql_bat *bat = c->data;
 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to