bug #1755339 Warn about rename dataase actually being copy/delete

This commit is contained in:
Marc Delisle
2007-07-19 15:34:02 +00:00
parent 7c0dfbf095
commit aee689a5a2
2 changed files with 32 additions and 3 deletions

View File

@@ -84,6 +84,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ [lang] Swedish update, thanks to Björn T. Hallberg + [lang] Swedish update, thanks to Björn T. Hallberg
+ [lang] Russian update, thanks to Victor Volkov and the php-myadmin.ru users + [lang] Russian update, thanks to Victor Volkov and the php-myadmin.ru users
+ [privileges] Support password hashing on the Edit Privileges interface + [privileges] Support password hashing on the Edit Privileges interface
- bug #1755339 Warn about rename dataase actually being copy/delete
2.10.3.0 (not yet released) 2.10.3.0 (not yet released)

View File

@@ -38,6 +38,19 @@ if (strlen($db) &&
$sql_query = ''; // in case target db exists $sql_query = ''; // in case target db exists
if ($move || if ($move ||
(isset($create_database_before_copying) && $create_database_before_copying)) { (isset($create_database_before_copying) && $create_database_before_copying)) {
/**
* @todo activate this with the correct version of MySQL
* when they fix the problem when the db contains a VIEW
* (problem exists in 5.1.20)
* also, in 6.0.0 when the db contains a Falcon table,
* renaming it results in a unusable db!
*/
//if (PMA_MYSQL_INT_VERSION >= 50107) {
// $local_query = 'RENAME DATABASE ' . PMA_backquote($db) . ' TO ' . PMA_backquote($newname) . ';';
// $sql_query = $local_query;
// PMA_DBI_query($local_query);
//} else {
// please indent ->
$local_query = 'CREATE DATABASE ' . PMA_backquote($newname); $local_query = 'CREATE DATABASE ' . PMA_backquote($newname);
if (isset($db_collation)) { if (isset($db_collation)) {
$local_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation); $local_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
@@ -121,6 +134,8 @@ if (strlen($db) &&
$GLOBALS['sql_query'] .= "\n" . $GLOBALS['sql_constraints_query_full_db']; $GLOBALS['sql_query'] .= "\n" . $GLOBALS['sql_constraints_query_full_db'];
unset($GLOBALS['sql_constraints_query_full_db']); unset($GLOBALS['sql_constraints_query_full_db']);
} }
// see the previous todo
// } // end else MySQL < 50107
// Duplicate the bookmarks for this db (done once for each db) // Duplicate the bookmarks for this db (done once for each db)
if ($db != $newname) { if ($db != $newname) {
@@ -136,9 +151,11 @@ if (strlen($db) &&
require_once './libraries/relation_cleanup.lib.php'; require_once './libraries/relation_cleanup.lib.php';
PMA_relationsCleanupDatabase($db); PMA_relationsCleanupDatabase($db);
$local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';'; if (PMA_MYSQL_INT_VERSION < 50107) {
$sql_query .= "\n" . $local_query; $local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';';
PMA_DBI_query($local_query); $sql_query .= "\n" . $local_query;
PMA_DBI_query($local_query);
}
$message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), $message = sprintf($strRenameDatabaseOK, htmlspecialchars($db),
htmlspecialchars($newname)); htmlspecialchars($newname));
} else { } else {
@@ -252,6 +269,17 @@ if (!$is_information_schema) {
?> ?>
</legend> </legend>
<input type="text" name="newname" size="30" class="textfield" value="" /> <input type="text" name="newname" size="30" class="textfield" value="" />
<?php
echo '(' . $strCommand . ': ';
/**
* @todo (see explanations above in a previous todo)
*/
//if (PMA_MYSQL_INT_VERSION >= 50107) {
// echo 'RENAME DATABASE';
//} else {
echo 'INSERT INTO ... SELECT';
//}
echo ')'; ?>
<input type="submit" value="<?php echo $strGo; ?>" /> <input type="submit" value="<?php echo $strGo; ?>" />
</fieldset> </fieldset>
</form> </form>