1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 15:16:44 +02:00

SQLite: Detect auto_increment primary key

This commit is contained in:
Jakub Vrana
2013-08-08 19:09:43 -07:00
parent bc725959e6
commit f6e24b1646

View 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"];