From 4e573ef087ff069ea39b4ffea040ef453ff6d966 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 9 Feb 2009 19:54:25 +0000 Subject: [PATCH] API: Query-continue prop=categoryinfo by cat_title rather than offset. Suggested by Brad Jorsch --- includes/api/ApiQueryCategoryInfo.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php index 115bd61315..a7c4fc4d0b 100644 --- a/includes/api/ApiQueryCategoryInfo.php +++ b/includes/api/ApiQueryCategoryInfo.php @@ -69,17 +69,15 @@ class ApiQueryCategoryInfo extends ApiQueryBase { $this->addWhere(array('cat_title' => $cattitles)); if(!is_null($params['continue'])) { - // We need to set a LIMIT in order to be able to set - // an OFFSET - $this->addOption('LIMIT', count($titles)); - $this->addOption('OFFSET', $params['continue']); - } + $title = $this->getDB()->addQuotes($params['continue']); + $this->addWhere("cat_title >= $title"); + } + $this->addOption('ORDER BY', 'cat_title'); $db = $this->getDB(); $res = $this->select(__METHOD__); $catids = array_flip($cattitles); - $count = (int)@$params['continue']; while($row = $db->fetchObject($res)) { $vals = array(); @@ -92,10 +90,9 @@ class ApiQueryCategoryInfo extends ApiQueryBase { $fit = $this->addPageSubItems($catids[$row->cat_title], $vals); if(!$fit) { - $this->setContinueEnumParameter('continue', $count); + $this->setContinueEnumParameter('continue', $row->cat_title); break; } - $count++; } $db->freeResult($res); } -- 2.20.1