[adminer-svn] SF.net SVN: adminer:[1306] trunk/adminer
Database management in a single PHP file
Brought to you by:
jakubvrana
|
From: <jak...@us...> - 2010-02-09 16:48:46
|
Revision: 1306
http://adminer.svn.sourceforge.net/adminer/?rev=1306&view=rev
Author: jakubvrana
Date: 2010-02-09 16:48:40 +0000 (Tue, 09 Feb 2010)
Log Message:
-----------
Allow editing of auto_increment value
Modified Paths:
--------------
trunk/adminer/create.inc.php
trunk/adminer/db.inc.php
Modified: trunk/adminer/create.inc.php
===================================================================
--- trunk/adminer/create.inc.php 2010-02-09 16:28:34 UTC (rev 1305)
+++ trunk/adminer/create.inc.php 2010-02-09 16:48:40 UTC (rev 1306)
@@ -70,7 +70,7 @@
$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 @@
$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 @@
<?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>');
Modified: trunk/adminer/db.inc.php
===================================================================
--- trunk/adminer/db.inc.php 2010-02-09 16:28:34 UTC (rev 1305)
+++ trunk/adminer/db.inc.php 2010-02-09 16:48:40 UTC (rev 1306)
@@ -56,7 +56,7 @@
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(" ", " ", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '</a>' : ' ');
$sums[$link] += ($row["Engine"] != "InnoDB" || $link != "edit" ? $row[$key] : 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|