bug #1401864, DROP VIEW instead of DROP TABLE

This commit is contained in:
Marc Delisle
2006-03-25 10:10:44 +00:00
parent 6523639ae3
commit e91fcb271d
3 changed files with 23 additions and 2 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2006-03-25 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_export.lib.php libraries/export/sql.php:
bug #1401864, DROP VIEW instead of DROP TABLE
2006-03-23 Marc Delisle <lem9@users.sourceforge.net>
* db_operations.php, tbl_properties_operations.php,
libraries/display_export.lib.php, lang/*: start work for bug #1401864,

View File

@@ -330,7 +330,18 @@ function show_checked_option() {
<input type="checkbox" name="drop" value="1" id="checkbox_dump_drop"
<?php PMA_exportCheckboxCheck('sql_drop_table'); ?> />
<label for="checkbox_dump_drop">
<?php echo sprintf($strAddClause, 'DROP TABLE'); ?></label><br />
<?php if ($export_type == 'table') {
if (PMA_Table::_isView($db,$table)) {
$drop_clause = 'DROP VIEW';
} else {
$drop_clause = 'DROP TABLE';
}
} elseif (PMA_MYSQL_INT_VERSION >= 50000) {
$drop_clause = 'DROP TABLE / DROP VIEW';
} else {
$drop_clause = 'DROP TABLE';
}
echo sprintf($strAddClause, $drop_clause); ?></label><br />
<input type="checkbox" name="if_not_exists" value="1"
id="checkbox_dump_if_not_exists"

View File

@@ -232,7 +232,13 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
$schema_create .= $new_crlf;
if (!empty($drop)) {
$schema_create .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table, $use_backquotes) . ';' . $crlf;
if (PMA_Table::_isView($db,$table)) {
$drop_clause = 'DROP VIEW';
} else {
$drop_clause = 'DROP TABLE';
}
$schema_create .= $drop_clause . ' IF EXISTS ' . PMA_backquote($table, $use_backquotes) . ';' . $crlf;
unset($drop_clause);
}
// Steve Alberty's patch for complete table dump,