Drop CASCADE for views. All objects have cascade now. REL_3-0-0-DEV-4
authorchriskl <chriskl>
Wed, 30 Apr 2003 07:42:55 +0000 (07:42 +0000)
committerchriskl <chriskl>
Wed, 30 Apr 2003 07:42:55 +0000 (07:42 +0000)
HISTORY
TODO
classes/database/Postgres.php
views.php

diff --git a/HISTORY b/HISTORY
index 3436bbce07fd9161531f30cccf47089172eb4b23..35ac5307930c577108b1b0a9c4aa148297068fcd 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -11,6 +11,7 @@ Version 3.0.0-dev-4
 * Reload browser after create/drop of database, schemas and tables
 * Select on views
 * Add foreign key constraint, with actions
+* Cascade drop on all objects
 
 Version 3.0.0-dev-3
 -------------------
diff --git a/TODO b/TODO
index c546b294f13fdad6a40dff626f59965f09c6ca36..302b087bce90302478562c2f6520cad1b1497d0d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -175,7 +175,7 @@ Translations
 Miscellaneous
 -------------
 
-* Add support for RESTRICT/CASCADE in 7.3
+* -Add support for RESTRICT/CASCADE in 7.3 (chriskl)
 
 Exotic
 ------
index 3efc4d8bc7b430e2f0a42662b72b6b66db7f194b..1dfa6960e41fc5314d420fd6c59d257fb63540fe 100755 (executable)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres.php,v 1.87 2003/04/30 07:37:39 chriskl Exp $
+ * $Id: Postgres.php,v 1.88 2003/04/30 07:42:58 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -1390,12 +1390,14 @@ class Postgres extends BaseDB {
        /**
         * Drops a view.
         * @param $viewname The name of the view to drop
+        * @param $cascade True to cascade drop, false to restrict
         * @return 0 success
         */
-       function dropView($viewname) {
+       function dropView($viewname, $cascade) {
                $this->fieldClean($viewname);
 
                $sql = "DROP VIEW \"{$viewname}\"";
+               if ($cascade) $sql .= " CASCADE";
 
                return $this->execute($sql);
        }
index 1a4aaa69934fcb06dbd11bdbe2edf86c4d8ee927..10d6648b084428bf7899d554649eec3f4f205379 100644 (file)
--- a/views.php
+++ b/views.php
@@ -3,7 +3,7 @@
        /**
         * Manage views in a database
         *
-        * $Id: views.php,v 1.9 2003/04/23 08:19:03 chriskl Exp $
+        * $Id: views.php,v 1.10 2003/04/30 07:42:58 chriskl Exp $
         */
 
        // Include application functions
                        echo "<input type=\"hidden\" name=\"action\" value=\"drop\">\n";
                        echo "<input type=\"hidden\" name=\"view\" value=\"", htmlspecialchars($_REQUEST['view']), "\">\n";
                        echo $misc->form;
-                       echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\"> <input type=\"submi\"t name=\"no\" value=\"{$lang['strno']}\">\n";
+                       // Show cascade drop option if supportd
+                       if ($localData->hasDropBehavior()) {
+                               echo "<p><input type=\"checkbox\" name=\"cascade\"> {$lang['strcascade']}</p>\n";
+                       }
+                       echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\"> <input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\">\n";
                        echo "</form>\n";
                }
                else {
-                       $status = $localData->dropView($_POST['view']);
+                       $status = $localData->dropView($_POST['view'], isset($_POST['cascade']));
                        if ($status == 0)
                                doDefault($lang['strviewdropped']);
                        else