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

Modified Files:
        sql.mx sql_gencode.mx sql_result.mx sql_user.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 sql_result.mx
Index: sql_result.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_result.mx,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- sql_result.mx       7 Dec 2008 21:53:25 -0000       1.99
+++ sql_result.mx       21 Dec 2008 19:38:21 -0000      1.100
@@ -478,8 +478,6 @@
                        showException(SQL, "sql", as.error);
                TABLETdestroy_format(&as);
        }
-
-       m->type = Q_UPDATE;
        return bats;
 }
 
@@ -941,7 +939,6 @@
         */
        if (!s) return 0;
        
-       assert(m->type == Q_UPDATE);
        if (stream_write(s, "&2 ", 3, 1) != 1 || 
           !mvc_send_lng(s, val) ||
            stream_write(s, " ", 1, 1) != 1 ||

U sql_gencode.mx
Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.304
retrieving revision 1.305
diff -u -d -r1.304 -r1.305
--- sql_gencode.mx      7 Dec 2008 20:25:50 -0000       1.304
+++ sql_gencode.mx      21 Dec 2008 19:38:21 -0000      1.305
@@ -441,14 +441,6 @@
                        else 
                                reconnect(mb, s->op1.lval);
                }       break;
-               case st_sql:{
-                       int o1 = _dumpstmt(sql, mb, s->op1.stval);
-
-                       q = newStmt1(mb, sqlRef, "eval");
-                       s->nr = getDestVar(q);
-                       q = pushArgument(mb, q, o1);
-                       q = pushBit(mb, q, FALSE);
-               } break;
                case st_var:{
                        if (s->op1.sval) {
                                if (VAR_GLOBAL(s->flag)) { /* globals */

U sql_user.mx
Index: sql_user.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_user.mx,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- sql_user.mx 10 Oct 2008 08:54:51 -0000      1.38
+++ sql_user.mx 21 Dec 2008 19:38:21 -0000      1.39
@@ -99,16 +99,17 @@
 }
 
 static str
-monet5_create_user(list *l, str user, str passwd, str fullname, sqlid 
schema_id, sqlid grantorid)
+monet5_create_user(ptr _mvc, str user, str passwd, str fullname, sqlid 
schema_id, sqlid grantorid)
 {
+       mvc *m = (mvc *)_mvc;
        oid uid = 0;
        bat bid = 0;
        BAT *scens;
        str ret;
-       char buf[BUFSIZ];
-       size_t user_id;
+       int user_id;
+       sql_schema *s = find_sql_schema(m->session->tr, "sys");
+        sql_table *db_user_info, *auths;
 
-       (void)l;
        /* prepare the scens BAT: it should contain the sql scenario */
        scens = BATnew(TYPE_str, TYPE_void, 1);
        BUNins(scens, "sql", 0, FALSE);
@@ -120,15 +121,12 @@
        }
        BBPunfix(bid);
 
-       /* create two SQL statements that insert the user in the SQL
-        * administration */
        user_id = (size_t)store_next_oid();
-       snprintf(buf, BUFSIZ, "INSERT INTO \"sys\".\"db_user_info\" 
VALUES('%s','%s',%d);", user, fullname, schema_id);
-       list_append(l, stmt_sql(_strdup(buf)));
-       snprintf(buf, BUFSIZ, "INSERT INTO \"sys\".\"auths\" VALUES(" SZFMT ", 
'%s', %d);", user_id, user, grantorid);
-       list_append(l, stmt_sql(_strdup(buf)));
-
-       return(NULL);
+        db_user_info = find_sql_table(s, "db_user_info");
+        auths = find_sql_table(s, "auths");
+       table_funcs.table_insert(m->session->tr, db_user_info, user, fullname, 
&schema_id );
+       table_funcs.table_insert(m->session->tr, auths, &user_id, user, 
&grantorid );
+       return NULL;
 }
 
 static BAT *

U sql.mx
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.301
retrieving revision 1.302
diff -u -d -r1.301 -r1.302
--- sql.mx      21 Dec 2008 14:06:36 -0000      1.301
+++ sql.mx      21 Dec 2008 19:38:21 -0000      1.302
@@ -1026,7 +1026,7 @@
                        return NULL;
                } else {
                        c->session->status = status;
-                       printf("# falling back to direct mode \n");
+                       //printf("# falling back to direct mode \n");
                        s = output_semantic(c, sym);
                }
        } else {
@@ -1940,7 +1940,6 @@
        (void) cntxt;
        if (msg)
                return msg;
-       c->type = Q_UPDATE;
        assert (mtype == TYPE_wrd);
        nr = *(wrd *) getArgReference(stk, pci, 1);
        if (mvc_export_affrows(c, b->out, nr, *w)) {


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

Reply via email to