1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-14 02:23:59 +02:00

Order by auto_increment column by default

This commit is contained in:
Jakub Vrana
2013-04-02 18:15:35 -07:00
parent 7769cab32c
commit 79b61855e5
2 changed files with 13 additions and 1 deletions

View File

@@ -278,7 +278,7 @@ username.form['auth[driver]'].onchange();
* @return null
*/
function selectOrderPrint($order, $columns, $indexes) {
print_fieldset("sort", lang('Sort'), $order);
print_fieldset("sort", lang('Sort'), $order && $_GET["order"]);
$i = 0;
foreach ((array) $_GET["order"] as $key => $val) {
if (isset($columns[$val])) {
@@ -441,6 +441,17 @@ username.form['auth[driver]'].onchange();
$return[] = (isset($fields[$val]) ? idf_escape($val) : $val) . (isset($_GET["desc"][$key]) ? " DESC" : "");
}
}
if (!$_GET["order"]) {
foreach ($fields as $name => $field) {
if ($field["auto_increment"]) {
foreach ($indexes as $index) {
if ($index["columns"] == array($name)) {
return array(idf_escape($name) . " DESC");
}
}
}
}
}
return $return;
}