1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 01:24:17 +02:00

Avoid overwriting existing tables when copying tables (bug #642)

This commit is contained in:
Jakub Vrana
2018-10-27 18:50:50 +02:00
parent 7f2dd73670
commit b327a76fc0
2 changed files with 3 additions and 5 deletions

View File

@@ -810,8 +810,7 @@ if (!defined("DRIVER")) {
queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");
foreach ($tables as $table) {
$name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table));
if (!queries("\nDROP TABLE IF EXISTS $name")
|| !queries("CREATE TABLE $name LIKE " . table($table))
if (!queries("CREATE TABLE $name LIKE " . table($table))
|| !queries("INSERT INTO $name SELECT * FROM " . table($table))
) {
return false;
@@ -826,9 +825,7 @@ if (!defined("DRIVER")) {
foreach ($views as $table) {
$name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table));
$view = view($table);
if (!queries("DROP VIEW IF EXISTS $name")
|| !queries("CREATE VIEW $name AS $view[select]") //! USE to avoid db.table
) {
if (!queries("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table
return false;
}
}