Default order only by common indexes in Editor

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@932 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-07-28 14:31:03 +00:00
parent 988456b2a6
commit fd6004fd3f

View file

@ -227,17 +227,9 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
if ($_GET["order"]) { if ($_GET["order"]) {
return array(idf_escape($_GET["order"][0]) . (isset($_GET["desc"][0]) ? " DESC" : "")); return array(idf_escape($_GET["order"][0]) . (isset($_GET["desc"][0]) ? " DESC" : ""));
} }
$index = $indexes[$_GET["index_order"]]; $index_order = $_GET["index_order"];
if (!strlen($_GET["index_order"])) { foreach ((strlen($index_order) ? array($indexes[$index_order]) : $indexes) as $index) {
foreach ($indexes as $index) { if (strlen($index_order) || $index["type"] == "INDEX") {
if ($index["type"] == "INDEX") {
break;
}
}
}
if (!$index) {
return array();
}
$desc = false; $desc = false;
foreach ($index["columns"] as $val) { foreach ($index["columns"] as $val) {
if (ereg('date|timestamp', $fields[$val]["type"])) { if (ereg('date|timestamp', $fields[$val]["type"])) {
@ -251,6 +243,9 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
} }
return $return; return $return;
} }
}
return array();
}
function selectLimitProcess() { function selectLimitProcess() {
return (isset($_GET["limit"]) ? $_GET["limit"] : "30"); return (isset($_GET["limit"]) ? $_GET["limit"] : "30");