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

Modified Files:
        sql_psm.mx 
Log Message:
changes to implement drop cascade.
The implementation of drop cascade operations is covered by the tests:
sql/src/test/DropCascade/

Note: All these tests should be green after this checkin..


Index: sql_psm.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_psm.mx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- sql_psm.mx  3 Jan 2007 12:39:47 -0000       1.33
+++ sql_psm.mx  17 Apr 2007 10:36:30 -0000      1.34
@@ -549,13 +549,12 @@
 }
 
 stmt* 
-drop_func(mvc *sql, dlist *qname)
+drop_func(mvc *sql, dlist *qname, int drop_action)
 {
        char *name = qname_table(qname);
        char *sname = qname_schema(qname);
        sql_schema *s = NULL;
        sql_func * func;
-       int dependency;
 
        if (sname && !(s = mvc_bind_schema(sql, sname)))
                return sql_error(sql, 02, "DROP FUNCTION: no such schema '%s'", 
sname);
@@ -572,13 +571,12 @@
        if (!schema_privs(sql->role_id, s)) {
                return sql_error(sql, 02, "DROP FUNCTION: access denied for %s 
to schema ;'%s'", stack_get_string(sql, "current_user"), s->base.name);
        }
-       dependency = mvc_check_dependency(sql, func->base.id, FUNC_DEPENDENCY);
-       if (dependency == HAS_DEPENDENCY)
+       
+       
+       if (!drop_action && mvc_check_dependency(sql, func->base.id, 
FUNC_DEPENDENCY))
                return sql_error(sql, 02, "DROP FUNCTION: there are functions 
dependent on function %s;", func->base.name);
-       else if (dependency == CICLE_DEPENDENCY)
-               return sql_error(sql, 02, "DROP FUNCTION: there are a cicle 
dependency, to drop this function you must use 'DROP FUNCTION %s CASCADE';", 
func->base.name);
-       mvc_drop_dependencies(sql, func->base.id);
-       mvc_drop_func(sql, s, name, 0);
+       
+       mvc_drop_func(sql, s, name, drop_action);
 
        return stmt_none();
 }
@@ -601,7 +599,7 @@
        {
                dlist *l = s->data.lval;
 
-                ret = drop_func(sql, l->h->data.lval);
+                ret = drop_func(sql, l->h->data.lval, l->h->next->data.ival);
                sql->type = Q_SCHEMA;
        }       break;
        case SQL_SET:


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