diff --git a/adminer/create.inc.php b/adminer/create.inc.php index eca2694e..c58c7ea4 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -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 diff --git a/adminer/view.inc.php b/adminer/view.inc.php index 772d9d9a..c627b446 100644 --- a/adminer/view.inc.php +++ b/adminer/view.inc.php @@ -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); ?>
diff --git a/changes.txt b/changes.txt index b15e0800..db16e452 100644 --- a/changes.txt +++ b/changes.txt @@ -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)