Update of /cvsroot/monetdb/sql/src/server
In directory sc8-pr-cvs16:/tmp/cvs-serv8205

Modified Files:
        sql_psm.mx sql_select.mx sql_updates.mx 
Log Message:
sql_psm now uses 'user' ipv 'sql_cache' module

sql_updates: use a private list for the cascading updates (prevent infinite 
loop)


Index: sql_psm.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_psm.mx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- sql_psm.mx  17 Apr 2007 10:36:30 -0000      1.34
+++ sql_psm.mx  18 Apr 2007 13:34:04 -0000      1.35
@@ -523,7 +523,7 @@
                        } else {
                                sql_destroy_params(sql);
 
-                               f = mvc_create_func(sql, sql->session->schema, 
fname, l, restype, TRUE, FALSE, "sql_cache", q);
+                               f = mvc_create_func(sql, sql->session->schema, 
fname, l, restype, TRUE, FALSE, "user", q);
                                if (b) {
                                        id_col_l = stmt_list_dependencies(b, 
COLUMN_DEPENDENCY);
                                        id_func_l = stmt_list_dependencies(b, 
FUNC_DEPENDENCY);

Index: sql_select.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_select.mx,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- sql_select.mx       1 Apr 2007 22:08:57 -0000       1.181
+++ sql_select.mx       18 Apr 2007 13:34:05 -0000      1.182
@@ -120,7 +120,10 @@
 
        /* colum or table function */
        st = tail_type(sq);
-       assert(st->comp_type);
+       if (!st->comp_type) {
+               (void) sql_error(sql, 02, "SELECT: '%s' does not return a 
table", tname);
+               return NULL;
+       }
        tv = scope_add_table(scp, sq, tname, NULL);
 
        /* foreach column add column name */

Index: sql_updates.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_updates.mx,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- sql_updates.mx      17 Apr 2007 10:33:54 -0000      1.113
+++ sql_updates.mx      18 Apr 2007 13:34:05 -0000      1.114
@@ -737,8 +737,9 @@
 }
 
 static stmt*
-sql_update_cascade_Fkeys(mvc *sql, sql_schema *schema, sql_key *k, int updcol, 
stmt **updates, list *l)
+sql_update_cascade_Fkeys(mvc *sql, sql_schema *schema, sql_key *k, int updcol, 
stmt **updates)
 {
+       list *l = NULL;
        int len = 0, i;
        node *m, *o;
        sql_idx *ri = ((sql_fkey*)k)->rkey->k.idx;
@@ -764,14 +765,15 @@
 
                if (updates[c->c->colnr]) {
                        upd = stmt_dup(updates[fc->c->colnr]->op2.stval);
-               } else
+               } else {
                        upd = stmt_atom(atom_general(&fc->c->type, NULL, 0));
+               }
 
                if (!upd || (upd = check_types(sql, &fc->c->type, upd, 
type_equal)) == NULL) {
-                               stmt_destroy(rows);
-                               list_destroy(l);
-                               cleanup_stmts(new_updates, len);
-                               return NULL;
+                       stmt_destroy(rows);
+                       list_destroy(l);
+                       cleanup_stmts(new_updates, len);
+                       return NULL;
                }
 
                if (upd->nrcols <= 0) 
@@ -781,13 +783,13 @@
                if (c->c->base.flag == TR_NEW)
                        new_updates[c->c->colnr] = stmt_replace(stmt_bat(fc->c, 
stmt_dup(fts), INS), stmt_dup(upd));
                else
-                       updates[c->c->colnr] = stmt_insert(stmt_bat(fc->c, 
stmt_dup(fts), UPD), stmt_dup(upd));
-               list_append(l, stmt_dup(new_updates[fc->c->colnr]));
+                       new_updates[c->c->colnr] = stmt_insert(stmt_bat(fc->c, 
stmt_dup(fts), UPD), stmt_dup(upd));
        }
 
        stmt_destroy(ts);
        stmt_destroy(fts);
        
+       l = create_stmt_list();
        if ((s = sql_update(sql, schema, t, new_updates, l)) == NULL) {
                list_destroy(l);
                cleanup_stmts(new_updates, len);
@@ -821,7 +823,7 @@
                                case ACT_SET_DEFAULT: 
                                        break;
                                case ACT_CASCADE: 
-                                       s = sql_update_cascade_Fkeys(sql, 
schema, fk, updcol, updates, l);
+                                       s = sql_update_cascade_Fkeys(sql, 
schema, fk, updcol, updates);
                                        list_prepend(l, s);
                                        break;
                                default:        /*RESTRICT*/


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to