]> git.joonet.de Git - adminer.git/commitdiff
Allow editing of auto_increment value
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 9 Feb 2010 16:48:40 +0000 (16:48 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 9 Feb 2010 16:48:40 +0000 (16:48 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1306 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/create.inc.php
adminer/db.inc.php

index 58b82a67702fd4df808198fc72e1c09195ca8cf8..b1636c422ef61900f79f1398d9aecf4ace167018 100644 (file)
@@ -70,7 +70,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
        $status = "COMMENT=" . $connection->quote($_POST["Comment"])
                . ($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? " ENGINE=" . $connection->quote($_POST["Engine"]) : "")
                . ($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? " COLLATE " . $connection->quote($_POST["Collation"]) : "")
-               . ($_POST["auto_increment"] != "" ? " AUTO_INCREMENT=" . preg_replace('~[^0-9]+~', '', $_POST["auto_increment"]) : "")
+               . ($_POST["Auto_increment"] != "" ? " AUTO_INCREMENT=" . preg_replace('~[^0-9]+~', '', $_POST["Auto_increment"]) : "")
        ;
        if (in_array($_POST["partition_by"], $partition_by)) {
                $partitions = array();
@@ -113,6 +113,9 @@ if ($_POST) {
        $row = $orig_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
+               $row["Auto_increment"] = "";
+       }
        foreach ($orig_fields as $field) {
                $field["has_default"] = isset($field["default"]);
                if ($field["on_update"]) {
@@ -162,7 +165,7 @@ foreach ($engines as $engine) {
 <?php $column_comments = edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys); ?>
 </table>
 <p>
-<?php echo lang('Auto Increment'); ?>: <input name="auto_increment" size="6" value="<?php echo h($row["auto_increment"]); // don't prefill by original Auto_increment for the sake of performance and not reusing deleted ids ?>">
+<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
 <?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo h($row["Comment"]); ?>" maxlength="60">
 <script type="text/javascript">
 document.write('<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>');
index 78c68d9d00b740f1e7f6143077b77a9493af2df8..a9fcfa693cf53bbaae139898a763713ed7514997 100644 (file)
@@ -56,7 +56,7 @@ if (!$table_status) {
                echo '<th><a href="' . h(ME) . 'table=' . urlencode($name) . '">' . h($name) . '</a>';
                if (isset($row["Rows"])) {
                        echo "<td>$row[Engine]<td>$row[Collation]";
-                       foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create", "Rows" => "select") as $key => $link) {
+                       foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "auto_increment=1&create", "Rows" => "select") as $key => $link) {
                                $val = number_format($row[$key], 0, '.', lang(','));
                                echo '<td align="right">' . ($row[$key] != "" ? '<a href="' . h(ME . "$link=") . urlencode($name) . '">' . str_replace(" ", "&nbsp;", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '</a>' : '&nbsp;');
                                $sums[$link] += ($row["Engine"] != "InnoDB" || $link != "edit" ? $row[$key] : 0);