]> git.joonet.de Git - adminer.git/commitdiff
SQLite: Show primary key when altering indexes
authorJakub Vrana <jakub@vrana.cz>
Tue, 6 Aug 2013 01:35:20 +0000 (18:35 -0700)
committerJakub Vrana <jakub@vrana.cz>
Tue, 6 Aug 2013 01:35:20 +0000 (18:35 -0700)
adminer/drivers/sqlite.inc.php
adminer/indexes.inc.php

index 6fd76726be06e6adfde307cbca824a1def66ef71..e8e6e12bfb6f99f7a6168e1ba2bcf6aba304c99e 100644 (file)
@@ -318,7 +318,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
                        }
                }
                if ($primary) {
-                       $return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array());
+                       $return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array()); //! column order, descending
                }
                $sqls = get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q($table));
                foreach (get_rows("PRAGMA index_list(" . table($table) . ")") as $row) {
index 9eb8710ab1ae333b02f6ceecba4db1ac6e102f32..b9006772d2462ee0184f04c45b9111bfba469d96 100644 (file)
@@ -6,7 +6,9 @@ if (preg_match('~MyISAM|M?aria' . ($connection->server_info >= 5.6 ? '|InnoDB' :
        $index_types[] = "FULLTEXT";
 }
 $indexes = indexes($TABLE);
+$primary = array();
 if ($jush == "sqlite") { // doesn't support primary key
+       $primary = $indexes[""];
        unset($index_types[0]);
        unset($indexes[""]);
 }
@@ -97,6 +99,14 @@ if (!$row) {
 <th><noscript><input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='<?php echo lang('Add next'); ?>'></noscript>&nbsp;
 </thead>
 <?php
+if ($primary) {
+       echo "<tr><td>PRIMARY<td>";
+       foreach ($primary["columns"] as $key => $column) {
+               echo "<select disabled>" . optionlist($fields, $column) . "</select>";
+               echo "<label><input disabled type='checkbox'>" . lang('descending') . "</label> ";
+       }
+       echo "<td><td>\n";
+}
 $j = 1;
 foreach ($row["indexes"] as $index) {
        if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {