Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12767/src/backends/monet5

Modified Files:
        sql_user.mx 
Log Message:
propagated changes of Wednesday Aug 12 2009
from the Aug2009 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/08/12 - stmane: src/backends/monet5/sql_user.mx,1.48.2.1

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".)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: sql_user.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_user.mx,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- sql_user.mx 22 May 2009 11:52:08 -0000      1.48
+++ sql_user.mx 12 Aug 2009 17:40:40 -0000      1.49
@@ -46,14 +46,14 @@
 sql_find_auth_schema(mvc *m, str auth)
 {
        int res = -1;
-       ssize_t rid;
+       oid rid;
        sql_schema *sys = find_sql_schema(m->session->tr, "sys");
        sql_table *users = find_sql_table(sys, "db_user_info");
        sql_column *users_name = find_sql_column(users, "name");
 
        rid = table_funcs.column_find_row(m->session->tr, users_name, auth, 
NULL);
 
-       if (rid >= 0) {
+       if (rid != oid_nil) {
                sql_column *users_schema = find_sql_column(users, 
"default_schema");
                int *p = (int *) table_funcs.column_find_value(m->session->tr, 
users_schema, rid);
 
@@ -70,7 +70,7 @@
 monet5_drop_user(ptr _mvc, str user)
 {
        mvc *m = (mvc *)_mvc;
-       ssize_t rid;
+       oid rid;
        sql_schema *sys;
        sql_table *users;
        sql_column *users_name;
@@ -88,7 +88,7 @@
        users_name = find_sql_column(users, "name");
 
        rid = table_funcs.column_find_row(m->session->tr, users_name, user, 
NULL);
-       if (rid >= 0)
+       if (rid != oid_nil)
                table_funcs.table_delete(m->session->tr, users, rid); 
                /* FIXME: We have to ignore this inconsistency here, because the
                 * user was already removed from the system authorisation. Once
@@ -262,14 +262,14 @@
 monet5_schema_has_user(ptr _mvc, sql_schema *s)
 {
        mvc *m = (mvc *)_mvc;
-       ssize_t rid;
+       oid rid;
        sql_schema *sys = find_sql_schema(m->session->tr, "sys");
        sql_table *users = find_sql_table(sys, "db_user_info");
        sql_column *users_schema = find_sql_column(users, "default_schema");
        sqlid schema_id = s->base.id;
 
        rid = table_funcs.column_find_row(m->session->tr, users_schema, 
&schema_id, NULL);
-       if (rid < 0)
+       if (rid == oid_nil)
                return FALSE;
        return TRUE;
 }
@@ -336,7 +336,7 @@
        }
 
        if (schema_id) {
-               ssize_t rid;
+               oid rid;
                sql_schema *sys = find_sql_schema(m->session->tr, "sys");
                sql_table *info = find_sql_table(sys, "db_user_info");
                sql_column *users_name = find_sql_column(info, "name");
@@ -344,7 +344,7 @@
 
                /* FIXME: we don't really check against the backend here */
                rid = table_funcs.column_find_row(m->session->tr, users_name, 
user, NULL);
-               if (rid < 0)
+               if (rid == oid_nil)
                        return FALSE;
 
                table_funcs.column_update_value(m->session->tr, users_schema, 
rid, &schema_id);
@@ -392,7 +392,7 @@
 str
 monet5_user_get_def_schema(mvc *m, oid user)
 {
-       ssize_t rid;
+       oid rid;
        sqlid schema_id;
        sql_schema *sys = NULL;
        sql_table *user_info = NULL;
@@ -425,7 +425,7 @@
        users_name = find_sql_column(user_info, "name");
        users_schema = find_sql_column(user_info, "default_schema");
 
-       if ((rid = table_funcs.column_find_row(m->session->tr, users_name, 
username, NULL)) >= 0)
+       if ((rid = table_funcs.column_find_row(m->session->tr, users_name, 
username, NULL)) != oid_nil)
                p = table_funcs.column_find_value(m->session->tr, users_schema, 
rid);
 
        assert(p);
@@ -438,12 +438,12 @@
        auths = find_sql_table(sys, "auths");
        auths_name = find_sql_column(auths, "name");
 
-       if ((rid = table_funcs.column_find_row(m->session->tr, schemas_id, 
&schema_id, NULL)) >= 0)
+       if ((rid = table_funcs.column_find_row(m->session->tr, schemas_id, 
&schema_id, NULL)) != oid_nil)
                schema = table_funcs.column_find_value(m->session->tr, 
schemas_name, rid);
 
        /* only set schema if user is found */
        rid = table_funcs.column_find_row(m->session->tr, auths_name, username, 
NULL);
-       if (rid >= 0) {
+       if (rid != oid_nil) {
                sql_column *auths_id = find_sql_column(auths, "id");
                int id;
                p = table_funcs.column_find_value(m->session->tr, auths_id, 
rid);


------------------------------------------------------------------------------
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