From 558df676d968d4c1ce21e1827facac2040c06932 Mon Sep 17 00:00:00 2001 From: ucorina Date: Tue, 6 Mar 2012 11:22:57 +0000 Subject: [PATCH] =?UTF-8?q?Issue=201597:=20XML=20query=EC=97=90=EC=84=9C?= =?UTF-8?q?=20page=20=EA=B0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10347 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/db/DBCubrid.class.php | 13 +++++++++++-- classes/db/DBFirebird.class.php | 18 ++++++++++++++---- classes/db/DBMssql.class.php | 23 ++++++++++++++++------- classes/db/DBMysql.class.php | 11 ++++++++++- classes/db/DBSqlite3_pdo.class.php | 11 ++++++++++- 5 files changed, 61 insertions(+), 15 deletions(-) diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index 165444499..5b0678fe4 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -654,8 +654,17 @@ $total_page = 1; } - // check the page variables - if ($page > $total_page) $page = $total_page; + // check the page variables + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page - 1) * $list_count; $query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count); diff --git a/classes/db/DBFirebird.class.php b/classes/db/DBFirebird.class.php index 8327cdcb6..404f0fd35 100644 --- a/classes/db/DBFirebird.class.php +++ b/classes/db/DBFirebird.class.php @@ -753,13 +753,23 @@ if ($total_count) $total_page = (int) (($total_count - 1) / $list_count) + 1; else $total_page = 1; - if($page > $total_page) $page = $total_page; + // check the page variables + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page-1)*$list_count; $query = $this->getSelectSql($queryObject, true, $start_count); - if(strpos($query, "substr")) { - $query = str_replace ("substr", "substring", $query); - $query = $this->replaceSubstrFormat($query); + if(strpos($query, "substr")) { + $query = str_replace ("substr", "substring", $query); + $query = $this->replaceSubstrFormat($query); } $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; $result = $this->_query ($query, null, $connection); diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index a9579edd5..8878e5389 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -514,14 +514,23 @@ $total_page = (int) (($total_count - 1) / $list_count) + 1; } else $total_page = 1; - // check the page variables - if ($page > $total_page) $page = $total_page; - $start_count = ($page - 1) * $list_count; + // check the page variables + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list - $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; - $result = $this->_query ($query, $connection); - if ($this->isError ()) - return $this->queryError($queryObject); + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } + $start_count = ($page - 1) * $list_count; + + $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; + $result = $this->_query ($query, $connection); + if ($this->isError ()) + return $this->queryError($queryObject); $virtual_no = $total_count - ($page - 1) * $list_count; $data = $this->_fetch($result, $virtual_no); diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 70c59d30a..48ce8811d 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -499,7 +499,16 @@ $total_page = 1; // check the page variables - if ($page > $total_page) $page = $total_page; + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page - 1) * $list_count; $query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count); diff --git a/classes/db/DBSqlite3_pdo.class.php b/classes/db/DBSqlite3_pdo.class.php index e8e7e1d0f..f990963b3 100644 --- a/classes/db/DBSqlite3_pdo.class.php +++ b/classes/db/DBSqlite3_pdo.class.php @@ -517,7 +517,16 @@ $total_page = 1; // check the page variables - if ($page > $total_page) $page = $total_page; + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page - 1) * $list_count; $this->_prepare($this->getSelectPageSql($queryObject, true, $start_count, $list_count));