mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 09:34:10 +02:00
MS SQL pagination
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1485 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -189,6 +189,9 @@ if (!$columns) {
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . error() . "\n";
|
||||
} else {
|
||||
if ($driver == "mssql") {
|
||||
$result->seek($limit * $page);
|
||||
}
|
||||
$email_fields = array();
|
||||
echo "<form action='' method='post' enctype='multipart/form-data'>\n";
|
||||
$rows = array();
|
||||
@@ -196,10 +199,12 @@ if (!$columns) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
// use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest)
|
||||
$found_rows = (intval($limit) && $group && count($group) < count($select)
|
||||
? ($driver == "sql" ? $connection->result(" SELECT FOUND_ROWS()") : $connection->result("SELECT COUNT(*) FROM ($query) x")) // space to allow mysql.trace_mode
|
||||
: count($rows)
|
||||
);
|
||||
if ($_GET["page"] != "last") {
|
||||
$found_rows = (intval($limit) && $group && count($group) < count($select)
|
||||
? ($driver == "sql" ? $connection->result(" SELECT FOUND_ROWS()") : $connection->result("SELECT COUNT(*) FROM ($query) x")) // space to allow mysql.trace_mode
|
||||
: count($rows)
|
||||
);
|
||||
}
|
||||
|
||||
if (!$rows) {
|
||||
echo "<p class='message'>" . lang('No rows.') . "\n";
|
||||
@@ -296,7 +301,7 @@ if (!$columns) {
|
||||
|
||||
if ($rows || $page) {
|
||||
$exact_count = true;
|
||||
if (intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
|
||||
if ($_GET["page"] != "last" && intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
|
||||
$found_rows = $table_status["Rows"];
|
||||
if (!isset($found_rows) || $where || 2 * $page * $limit > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e4)) {
|
||||
// slow with big tables
|
||||
|
Reference in New Issue
Block a user