Don't alter table comment if not changed (was crashing MySQL Cluster)

This commit is contained in:
Jakub Vrana 2014-11-18 09:50:02 -08:00
parent 594c626665
commit 0b0c0c7e89
3 changed files with 8 additions and 5 deletions

View file

@ -107,7 +107,7 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
$name, $name,
($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields), ($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields),
$foreign, $foreign,
$row["Comment"], ($row["Comment"] != $table_status["Comment"] ? $row["Comment"] : null),
($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""), ($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""),
($row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : ""), ($row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : ""),
($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""), ($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""),

View file

@ -662,20 +662,22 @@ if (!defined("DRIVER")) {
); );
} }
$alter = array_merge($alter, $foreign); $alter = array_merge($alter, $foreign);
$status = "COMMENT=" . q($comment) $status = ($comment !== null ? " COMMENT=" . q($comment) : "")
. ($engine ? " ENGINE=" . q($engine) : "") . ($engine ? " ENGINE=" . q($engine) : "")
. ($collation ? " COLLATE " . q($collation) : "") . ($collation ? " COLLATE " . q($collation) : "")
. ($auto_increment != "" ? " AUTO_INCREMENT=$auto_increment" : "") . ($auto_increment != "" ? " AUTO_INCREMENT=$auto_increment" : "")
. $partitioning . $partitioning
; ;
if ($table == "") { if ($table == "") {
return queries("CREATE TABLE " . table($name) . " (\n" . implode(",\n", $alter) . "\n) $status"); return queries("CREATE TABLE " . table($name) . " (\n" . implode(",\n", $alter) . "\n)$status");
} }
if ($table != $name) { if ($table != $name) {
$alter[] = "RENAME TO " . table($name); $alter[] = "RENAME TO " . table($name);
} }
$alter[] = $status; if ($status) {
return queries("ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter)); $alter[] = ltrim($status);
}
return $alter ? queries("ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter)) : true;
} }
/** Run commands to alter indexes /** Run commands to alter indexes

View file

@ -7,6 +7,7 @@ Specify encoding for PHP 5.6 with invalid default_charset
Fix saving NULL value, bug since Adminer 4.0.3 Fix saving NULL value, bug since Adminer 4.0.3
Send 403 for auth error Send 403 for auth error
Report offline and other AJAX errors (bug #419) Report offline and other AJAX errors (bug #419)
Don't alter table comment if not changed
Add links to documentation on table status page Add links to documentation on table status page
MySQL: Use utf8mb4 if available MySQL: Use utf8mb4 if available
MySQL: Support foreign keys in NDB storage MySQL: Support foreign keys in NDB storage