SQLite: Display auto-created unique indexes
This commit is contained in:
parent
f4592e3603
commit
3e2288eee5
|
@ -352,20 +352,24 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
$sqls = get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q($table), $connection2);
|
$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) {
|
foreach (get_rows("PRAGMA index_list(" . table($table) . ")", $connection2) as $row) {
|
||||||
$name = $row["name"];
|
$name = $row["name"];
|
||||||
if (!preg_match("~^sqlite_~", $name)) {
|
$index = array("type" => ($row["unique"] ? "UNIQUE" : "INDEX"));
|
||||||
$return[$name]["type"] = ($row["unique"] ? "UNIQUE" : "INDEX");
|
$index["lengths"] = array();
|
||||||
$return[$name]["lengths"] = array();
|
$index["descs"] = array();
|
||||||
foreach (get_rows("PRAGMA index_info(" . idf_escape($name) . ")", $connection2) as $row1) {
|
foreach (get_rows("PRAGMA index_info(" . idf_escape($name) . ")", $connection2) as $row1) {
|
||||||
$return[$name]["columns"][] = $row1["name"];
|
$index["columns"][] = $row1["name"];
|
||||||
}
|
$index["descs"][] = null;
|
||||||
$return[$name]["descs"] = array();
|
}
|
||||||
if (preg_match('~^CREATE( UNIQUE)? INDEX ' . preg_quote(idf_escape($name) . ' ON ' . idf_escape($table), '~') . ' \((.*)\)$~i', $sqls[$name], $regs)) {
|
if (preg_match('~^CREATE( UNIQUE)? INDEX ' . preg_quote(idf_escape($name) . ' ON ' . idf_escape($table), '~') . ' \((.*)\)$~i', $sqls[$name], $regs)) {
|
||||||
preg_match_all('/("[^"]*+")+( DESC)?/', $regs[2], $matches);
|
preg_match_all('/("[^"]*+")+( DESC)?/', $regs[2], $matches);
|
||||||
foreach ($matches[2] as $val) {
|
foreach ($matches[2] as $key => $val) {
|
||||||
$return[$name]["descs"][] = ($val ? '1' : null);
|
if ($val) {
|
||||||
|
$index["descs"][$key] = '1';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$return[""] || $index["type"] != "UNIQUE" || $index["columns"] != $return[""]["columns"] || $index["descs"] != $return[""]["descs"] || !preg_match("~^sqlite_~", $name)) {
|
||||||
|
$return[$name] = $index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Adminer 4.0.4-dev:
|
Adminer 4.0.4-dev:
|
||||||
|
SQLite: Display auto-created unique indexes, bug since Adminer 3.5.0
|
||||||
|
|
||||||
Adminer 4.0.3 (released 2014-02-01)
|
Adminer 4.0.3 (released 2014-02-01)
|
||||||
MongoDB: insert, truncate, indexes
|
MongoDB: insert, truncate, indexes
|
||||||
|
|
Loading…
Reference in a new issue