Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql	20 Apr 2001 20:51:09 -0000	1.1
+++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql	29 Jun 2001 20:28:38 -0000	1.2
@@ -20,45 +20,23 @@
 -- will fail and removing bboard will be icky.  this is sort of hairy
 -- problem with unknown potential intra-package references.
 
-declare
-    image_p    integer;
+-- 
 
-    cursor children_cursor is
-	select object_id as child_id, object_type
-            from acs_objects
-            where (object_type = 'acs_message' 
-	          or object_type = 'content_item')
-                  and context_id in (select distinct m.message_id
-	                                 from acs_messages m, bboard_forum_message_map f
-                                         where m.message_id = f.message_id);
-begin
-    for child_val in children_cursor loop
-        if child_val.object_type = 'acs_message' then
-   	    acs_message.delete(child_val.child_id);
-	elsif child_val.object_type = 'content_item' then
-	    select count(*) into image_p
-                from images
-                where image_id = child_val.child_id;
-            if image_p = 1 then
-                acs_message.delete_image(child_val.child_id);
-            else
-                acs_message.delete_file(child_val.child_id);
-            end if;
-        end if;
-    end loop;
-end;
-/
-show errors
-
 -- Delete all messages that belong to forums
 declare
     cursor message_cursor is
-        select distinct m.message_id
-            from acs_messages m, bboard_forum_message_map f
-            where m.message_id = f.message_id;
+        select object_id as message_id
+	    from acs_objects
+	    where object_id in (select object_id
+                                  from acs_objects
+	                          where object_type = 'acs_message'
+    	                          start with context_id in (select forum_id
+                                                              from bboard_forums)
+	                          connect by prior object_id = context_id)
+            order by object_id desc;
 begin
     for message_val in message_cursor loop
-        acs_message.delete(message_val.message_id);
+        bboard_message.remove(message_val.message_id);
     end loop;
 end;
 /
