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;
}

View file

@ -1,4 +1,5 @@
Adminer 3.6.4-dev:
Order by auto_increment column by default
Display select SQL edit form inline
Compatibility with MySQL 5.6
Recover original view, trigger, routine if creating fails