echo "<p>" . lang('Move to other database') . ": ";
echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '" autocapitalize="off">');
echo " <input type='submit' name='move' value='" . lang('Move') . "'>";
- echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "");
+ echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'> " . checkbox("overwrite", 1, $_POST["overwrite"], lang('overwrite')) : "");
echo "\n";
}
echo "<input type='hidden' name='all' value=''>"; // used by trCheck()
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("CREATE TABLE $name LIKE " . table($table))
+ if (($_POST["overwrite"] && !queries("\nDROP TABLE IF EXISTS $name"))
+ || !queries("CREATE TABLE $name LIKE " . table($table))
|| !queries("INSERT INTO $name SELECT * FROM " . table($table))
) {
return false;
foreach ($views as $table) {
$name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table));
$view = view($table);
- if (!queries("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table
+ if (($_POST["overwrite"] && !queries("DROP VIEW IF EXISTS $name"))
+ || !queries("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table
return false;
}
}
'Tables have been moved.' => 'Tabulky byly přesunuty.',
'Copy' => 'Zkopírovat',
'Tables have been copied.' => 'Tabulky byly zkopírovány.',
+ 'overwrite' => 'přepsat',
'Routines' => 'Procedury a funkce',
'Routine has been called, %d row(s) affected.' => array('Procedura byla zavolána, byl změněn %d záznam.', 'Procedura byla zavolána, byly změněny %d záznamy.', 'Procedura byla zavolána, bylo změněno %d záznamů.'),
'Tables have been moved.' => 'Xx.',
'Copy' => 'Xx',
'Tables have been copied.' => 'Xx.',
+ 'overwrite' => 'xx',
'Routines' => 'Xx',
'Routine has been called, %d row(s) affected.' => array('Xx, %d.', 'Xx, %d.'),
Adminer 4.7.2-dev:
Do not attempt logging in without password (bug #676)
Stretch footer over the whole table width (bug #624)
+Allow overwriting tables when copying them
MySQL: Fix creating users and changing password in MySQL 8 (bug #663)
Adminer 4.7.1 (released 2019-01-24):