Update of /cvsroot/monetdb/sql/src/storage/bat
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18038/bat

Modified Files:
      Tag: SQL_2-18
        bat_dependency.mx bat_store.mx 
Log Message:
Correct the dependencies check for the functions with the same name. 
DROP ALL f1; 
This query will drop all the functions with the name f1 and also the 
dependencies between them.
However, if there is dependencies to other objects the query is aborted.
Note: The same was implemented for procedures.


Index: bat_store.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_store.mx,v
retrieving revision 1.138
retrieving revision 1.138.2.1
diff -u -d -r1.138 -r1.138.2.1
--- bat_store.mx        23 May 2007 22:06:00 -0000      1.138
+++ bat_store.mx        8 Jun 2007 11:53:51 -0000       1.138.2.1
@@ -4475,7 +4475,7 @@
        short dep_type = 0;
        sql_table *t = NULL;
 
-       list *dep = sql_trans_get_dependencies(tr, id, type);
+       list *dep = sql_trans_get_dependencies(tr, id, type, NULL);
        node *n = dep->h, *t_n = NULL;
 
 

Index: bat_dependency.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_dependency.mx,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- bat_dependency.mx   17 Apr 2007 10:27:32 -0000      1.13
+++ bat_dependency.mx   8 Jun 2007 11:53:50 -0000       1.13.2.1
@@ -35,7 +35,18 @@
 #include "sql_config.h"
 #include "bat_dependency.h"
 
-
+int
+list_find_func_id(list *ids, int id) {
+       node *n = ids->h;
+       while(n) {
+               sql_func * f = n->data;
+               if (f->base.id == id)
+                       return id;
+               else 
+                       n = n->next;
+       }
+       return 0;
+}
 
 sql_column*
 create_column(sql_trans *tr, sql_table* t, char* table, char *type, int digits)
@@ -101,7 +112,7 @@
 }
 /*It returns a list with depend_id_1, depend_type_1, depend_id_2, 
depend_type_2, ....*/
 list*
-sql_trans_get_dependencies(sql_trans* tr, int id, short depend_type)
+sql_trans_get_dependencies(sql_trans* tr, int id, short depend_type, list * 
ignore_ids)
 {
        node *id_node, *type_node, *trig_node;
        sql_schema *s;
@@ -125,9 +136,10 @@
 
        while (id_node && type_node)
        {
-       
-               list_append(dep_list, id_node->data);
-               list_append(dep_list, (short *) type_node->data);
+               if (!(ignore_ids  && list_find_func_id(ignore_ids, *(int *) 
id_node->data))) {
+                       list_append(dep_list, id_node->data);
+                       list_append(dep_list, (short *) type_node->data);
+               }
                id_node = id_node->next;
                type_node = type_node->next;
        }


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