* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.82 2003/04/30 06:49:11 chriskl Exp $
+ * $Id: Postgres.php,v 1.83 2003/04/30 06:56:31 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
/**
* Removes an index from the database
* @param $index The index to drop
+ * @param $cascade True to cascade drop, false to restrict
* @return 0 success
*/
- function dropIndex($index) {
+ function dropIndex($index, $cascade) {
$this->fieldClean($index);
$sql = "DROP INDEX \"{$index}\"";
+ if ($cascade) $sql .= " CASCADE";
return $this->execute($sql);
}
/**
* List indexes on a table
*
- * $Id: indexes.php,v 1.11 2003/04/23 08:58:27 chriskl Exp $
+ * $Id: indexes.php,v 1.12 2003/04/30 06:56:31 chriskl Exp $
*/
// Include application functions
echo "<p>", sprintf($lang['strconfdropindex'], htmlspecialchars($_REQUEST['index'])), "</p>\n";
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
- echo "<input type=hidden name=action value=drop_index>\n";
- echo "<input type=hidden name=table value=\"", htmlspecialchars($_REQUEST['table']), "\">\n";
- echo "<input type=hidden name=index value=\"", htmlspecialchars($_REQUEST['index']), "\">\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"drop_index\">\n";
+ echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\">\n";
+ echo "<input type=\"hidden\" name=\"index\" value=\"", htmlspecialchars($_REQUEST['index']), "\">\n";
echo $misc->form;
- echo "<input type=submit name=yes value=\"{$lang['stryes']}\"> <input type=submit 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->dropIndex($_POST['index'], 'RESTRICT');
+ $status = $localData->dropIndex($_POST['index'], isset($_POST['cascade']));
if ($status == 0)
doDefault($lang['strindexdropped']);
else