Issue 1597: XML query에서 page 값

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10347 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2012-03-06 11:22:57 +00:00
parent d8ce5b5a4a
commit 558df676d9
5 changed files with 61 additions and 15 deletions

View file

@ -654,8 +654,17 @@
$total_page = 1; $total_page = 1;
} }
// check the page variables // 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; $start_count = ($page - 1) * $list_count;
$query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count); $query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count);

View file

@ -753,13 +753,23 @@
if ($total_count) $total_page = (int) (($total_count - 1) / $list_count) + 1; if ($total_count) $total_page = (int) (($total_count - 1) / $list_count) + 1;
else $total_page = 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; $start_count = ($page-1)*$list_count;
$query = $this->getSelectSql($queryObject, true, $start_count); $query = $this->getSelectSql($queryObject, true, $start_count);
if(strpos($query, "substr")) { if(strpos($query, "substr")) {
$query = str_replace ("substr", "substring", $query); $query = str_replace ("substr", "substring", $query);
$query = $this->replaceSubstrFormat($query); $query = $this->replaceSubstrFormat($query);
} }
$query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
$result = $this->_query ($query, null, $connection); $result = $this->_query ($query, null, $connection);

View file

@ -514,14 +514,23 @@
$total_page = (int) (($total_count - 1) / $list_count) + 1; $total_page = (int) (($total_count - 1) / $list_count) + 1;
} else $total_page = 1; } else $total_page = 1;
// check the page variables // check the page variables
if ($page > $total_page) $page = $total_page; if ($page > $total_page) {
$start_count = ($page - 1) * $list_count; // 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):''; $buff = new Object ();
$result = $this->_query ($query, $connection); $buff->total_count = $total_count;
if ($this->isError ()) $buff->total_page = $total_page;
return $this->queryError($queryObject); $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; $virtual_no = $total_count - ($page - 1) * $list_count;
$data = $this->_fetch($result, $virtual_no); $data = $this->_fetch($result, $virtual_no);

View file

@ -499,7 +499,16 @@
$total_page = 1; $total_page = 1;
// check the page variables // 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; $start_count = ($page - 1) * $list_count;
$query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count); $query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count);

View file

@ -517,7 +517,16 @@
$total_page = 1; $total_page = 1;
// check the page variables // 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; $start_count = ($page - 1) * $list_count;
$this->_prepare($this->getSelectPageSql($queryObject, true, $start_count, $list_count)); $this->_prepare($this->getSelectPageSql($queryObject, true, $start_count, $list_count));