Permalink
Browse files

Drop CASCADE for views. All objects have cascade now.

  • Loading branch information...
1 parent d9660d0 commit 317ef62f2d0a671b983af6f4ce661d640c8b0e97 chriskl committed Apr 30, 2003
Showing with 13 additions and 6 deletions.
  1. +1 −0 HISTORY
  2. +1 −1 TODO
  3. +4 −2 classes/database/Postgres.php
  4. +7 −3 views.php
View
@@ -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
-------------------
View
@@ -175,7 +175,7 @@ Translations
Miscellaneous
-------------
-* Add support for RESTRICT/CASCADE in 7.3
+* -Add support for RESTRICT/CASCADE in 7.3 (chriskl)
Exotic
------
@@ -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 @@ function createView($viewname, $definition) {
/**
* 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);
}
View
@@ -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
@@ -185,11 +185,15 @@ function doDrop($confirm) {
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

0 comments on commit 317ef62

Please sign in to comment.