コード例 #1
0
 public function buildLimit(Fetcher $fetcher)
 {
     $offset = null;
     $limit = null;
     if ($fetcher->hasLimit()) {
         $offset = ($fetcher->getPage() - 1) * $fetcher->getNbByPage();
         $limit = $fetcher->getNbByPage();
     }
     return array('offset' => $offset, 'limit' => $limit);
 }
コード例 #2
0
 public function buildLimit(Fetcher $fetcher)
 {
     if (!$fetcher->hasLimit()) {
         return '';
     } else {
         $offset = ($fetcher->getPage() - 1) * $fetcher->getNbByPage();
         $sql = sprintf(" LIMIT %s OFFSET %s", $fetcher->getNbByPage(), $offset);
         return $sql;
     }
 }