$db = $this->getDB();
$res = $this->select(__METHOD__);
- $data = array();
- $lastId = 0; // database has no ID 0
$count = 0;
while ($row = $db->fetchObject($res)) {
if (++$count > $params['limit']) {
$this->setContinueEnumParameter('offset', @$params['offset'] + $params['limit']);
break;
}
- if ($lastId != $row->el_from) {
- if($lastId != 0) {
- $this->addPageSubItems($lastId, $data);
- $data = array();
- }
- $lastId = $row->el_from;
- }
-
$entry = array();
ApiResult :: setContent($entry, $row->el_to);
- $data[] = $entry;
- }
-
- if($lastId != 0) {
- $this->addPageSubItems($lastId, $data);
+ $fit = $this->addPageSubItem($row->el_from, $entry);
+ if(!$fit)
+ {
+ $this->setContinueEnumParameter('offset', @$params['offset'] + $count - 1);
+ break;
+ }
}
-
$db->freeResult($res);
}
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiQueryExternalLinks.php 37270 2008-07-07 17:32:22Z catrope $';
+ return __CLASS__ . ': $Id: ApiQueryExternalLinks.php 46845 2009-02-05 14:30:59Z catrope $';
}
-}
+}
\ No newline at end of file