]> git.joonet.de Git - adminer.git/commitdiff
Display error on invalid alter table and view pages
authorJakub Vrana <jakub@vrana.cz>
Mon, 24 Jun 2013 16:08:26 +0000 (09:08 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 24 Jun 2013 16:08:26 +0000 (09:08 -0700)
adminer/create.inc.php
adminer/view.inc.php
changes.txt

index eca2694e5a7cd5444cd2a279e1bf2061e2a2e681..c58c7ea4c92eb3f67fd77a361d1800ed1b215912 100644 (file)
@@ -9,10 +9,13 @@ foreach ($referencable_primary as $table_name => $field) {
 }
 
 $orig_fields = array();
-$orig_status = array();
+$table_status = array();
 if ($TABLE != "") {
        $orig_fields = fields($TABLE);
-       $orig_status = table_status($TABLE);
+       $table_status = table_status($TABLE);
+       if (!$table_status) {
+               $error = lang('No tables.');
+       }
 }
 
 $row = $_POST;
@@ -80,7 +83,7 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
                                ? " (" . implode(",", $partitions) . "\n)"
                                : ($row["partitions"] ? " PARTITIONS " . (+$row["partitions"]) : "")
                        );
-               } elseif (support("partitioning") && ereg("partitioned", $orig_status["Create_options"])) {
+               } elseif (support("partitioning") && ereg("partitioned", $table_status["Create_options"])) {
                        $partitioning .= "\nREMOVE PARTITIONING";
                }
                
@@ -97,8 +100,8 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
                        ($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields),
                        $foreign,
                        $row["Comment"],
-                       ($row["Engine"] && $row["Engine"] != $orig_status["Engine"] ? $row["Engine"] : ""),
-                       ($row["Collation"] && $row["Collation"] != $orig_status["Collation"] ? $row["Collation"] : ""),
+                       ($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""),
+                       ($row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : ""),
                        ($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""),
                        $partitioning
                ));
@@ -115,7 +118,7 @@ if (!$_POST) {
        );
        
        if ($TABLE != "") {
-               $row = $orig_status;
+               $row = $table_status;
                $row["name"] = $TABLE;
                $row["fields"] = array();
                if (!$_GET["auto_increment"]) { // don't prefill by original Auto_increment for the sake of performance and not reusing deleted ids
index 772d9d9a7d48c6242fce3d2c3d7ca23b86590a8e..c627b446315a23df38db5d28acf081688df8f8de 100644 (file)
@@ -28,12 +28,15 @@ if ($_POST && !$error) {
        }
 }
 
-page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
-
 if (!$_POST && $TABLE != "") {
        $row = view($TABLE);
        $row["name"] = $TABLE;
+       if (!$error) {
+               $error = $connection->error;
+       }
 }
+
+page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
 ?>
 
 <form action="" method="post">
index b15e0800460b451a4a4482b45421ba0522c7c05d..db16e4528280e779bf8fecca5c72b94d981f6573 100644 (file)
@@ -8,6 +8,7 @@ Verify UTF-8 encoding of CSV import
 Notify user about expired master password for permanent login
 Send 404 for invalid database and schema
 Fix title and links on invalid table pages
+Display error on invalid alter table and view pages
 MySQL: Speed up updating rows without numeric or UTF-8 primary key
 PostgreSQL: Fix detecting oid column in PDO
 PostgreSQL: Handle timestamp types (bug #3614086)