]> git.joonet.de Git - adminer.git/commitdiff
SQLite: Detect auto_increment primary key
authorJakub Vrana <jakub@vrana.cz>
Fri, 9 Aug 2013 02:09:43 +0000 (19:09 -0700)
committerJakub Vrana <jakub@vrana.cz>
Fri, 9 Aug 2013 02:09:43 +0000 (19:09 -0700)
adminer/drivers/sqlite.inc.php

index 13972886e5491db3a1ba18b797c78ba863aa1b18..7fce6e34cbfc616cb25efa3f4566ed42f34557a5 100644 (file)
@@ -333,6 +333,13 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
                                $return[""]["descs"][] = (preg_match('~DESC~i', $match[5]) ? '1' : null);
                        }
                }
+               if (!$return) {
+                       foreach (fields($table) as $name => $field) {
+                               if ($field["primary"]) {
+                                       $return[""] = array("type" => "PRIMARY", "columns" => array($name), "lengths" => array(), "descs" => array());
+                               }
+                       }
+               }
                $sqls = get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q($table), $connection2);
                foreach (get_rows("PRAGMA index_list(" . table($table) . ")", $connection2) as $row) {
                        $name = $row["name"];