]> git.joonet.de Git - adminer.git/commitdiff
Don't alter table comment if not changed (was crashing MySQL Cluster)
authorJakub Vrana <jakub@vrana.cz>
Tue, 18 Nov 2014 17:50:02 +0000 (09:50 -0800)
committerJakub Vrana <jakub@vrana.cz>
Tue, 18 Nov 2014 17:50:02 +0000 (09:50 -0800)
adminer/create.inc.php
adminer/drivers/mysql.inc.php
changes.txt

index c0e636a9080ac64730ced94197ac2e0b9aabfb07..d813dbb60711041efd5b9198476cedaaad656a91 100644 (file)
@@ -107,7 +107,7 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
                        $name,
                        ($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields),
                        $foreign,
-                       $row["Comment"],
+                       ($row["Comment"] != $table_status["Comment"] ? $row["Comment"] : null),
                        ($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""),
                        ($row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : ""),
                        ($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""),
index 8705f5bb236f43c3688291a9423999ab8698ca14..3ca7abb9e44fe8b25056e352d671483bb992bd42 100644 (file)
@@ -662,20 +662,22 @@ if (!defined("DRIVER")) {
                        );
                }
                $alter = array_merge($alter, $foreign);
-               $status = "COMMENT=" . q($comment)
+               $status = ($comment !== null ? " COMMENT=" . q($comment) : "")
                        . ($engine ? " ENGINE=" . q($engine) : "")
                        . ($collation ? " COLLATE " . q($collation) : "")
                        . ($auto_increment != "" ? " AUTO_INCREMENT=$auto_increment" : "")
                        . $partitioning
                ;
                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) {
                        $alter[] = "RENAME TO " . table($name);
                }
-               $alter[] = $status;
-               return queries("ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter));
+               if ($status) {
+                       $alter[] = ltrim($status);
+               }
+               return $alter ? queries("ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter)) : true;
        }
 
        /** Run commands to alter indexes
index 95fca1697ece49a38e0ab575b6649052fe79b4a1..fce223dae00b3131aa0885a88fb5e327bac15748 100644 (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
 Send 403 for auth error
 Report offline and other AJAX errors (bug #419)
+Don't alter table comment if not changed
 Add links to documentation on table status page
 MySQL: Use utf8mb4 if available
 MySQL: Support foreign keys in NDB storage