示例#1
0
 /**
  * Return the query, with the paging applied to it.
  * @return String the sql query
  */
 public function getQuery()
 {
     if ($this->paging == null) {
         return $this->sql;
     }
     $search = $this->paging->getSearchInfo();
     if ($search != null && $this->includeFilter) {
         $this->applySearchFilter($search);
     }
     $newSql = "select SQL_CALC_FOUND_ROWS * from (" . $this->sql . ") _x";
     if ($this->paging->getOrderByColumn()) {
         $newSql .= " order by " . $this->paging->getOrderByColumn();
         $newSql .= $this->paging->isOrderByAscending() ? ' asc' : ' desc';
     }
     $newSql .= " limit " . $this->paging->getFirstRecord() . ", " . $this->paging->getRecordsPerPage();
     return $newSql;
 }