Beispiel #1
0
 /**
  * Getting the total count for the search criteria
  *
  * @param DaoQuery $qry      The dao query
  * @param string   $criteria The where clause
  * @param array    $params   The parameters
  *
  * @return int
  */
 public static function countByCriteria(DaoQuery $qry, $criteria, $params = array())
 {
     self::connect();
     $qry->getPage(null, DaoQuery::DEFAUTL_PAGE_SIZE);
     $qry = $qry->where($criteria);
     $sql = $qry->generateForCount();
     $results = self::_getResults($qry, $sql, $params, self::AS_ARRAY);
     return isset($results[0]) && isset($results[0][0]) ? $results[0][0] : 0;
 }