Order of columns in table

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@397 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2008-05-07 11:22:08 +00:00
parent 478e9c82c5
commit fd8948ffa0
4 changed files with 44 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
<?php
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
if ($_POST["drop"]) {
if ($mysql->query("DROP TABLE " . idf_escape($_GET["create"]))) {
redirect(substr($SELF, 0, -1), lang('Table has been dropped.'));
@@ -29,7 +29,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
. ($field["null"] ? " NULL" : " NOT NULL") // NULL for timestamp
. ($key == $_POST["auto_increment_col"] ? " AUTO_INCREMENT$auto_increment_index" : "")
. " COMMENT '" . $mysql->escape_string($field["comment"]) . "'"
. (strlen($_GET["create"]) && !strlen($field["orig"]) ? $after : "")
. (strlen($_GET["create"]) ? " $after" : "")
;
$after = "AFTER " . idf_escape($field["field"]);
} elseif (strlen($field["orig"])) {
@@ -67,11 +67,7 @@ $result->free();
if ($_POST) {
$row = $_POST;
ksort($row["fields"]);
$row["fields"] = array_values($row["fields"]);
if ($_POST["add"]) {
array_splice($row["fields"], key($_POST["add"]), 0, array(array()));
}
process_fields($row["fields"]);
if ($row["auto_increment_col"]) {
$row["fields"][$row["auto_increment_col"] - 1]["auto_increment"] = true;
}