Exemplo n.º 1
0
 /**
  * 指定字段取出内容
  * @param string $fields
  * @param $limit
  * @param $offset
  * @param array $where
  * @param bool $enableCache
  * @param string $groupBy
  * @param string $orderBy
  * @return int
  */
 public function countByFieldName($fields = '', $limit, $offset, $where = array(), $enableCache = false, $groupBy = '', $orderBy = '')
 {
     $condition['fields'] = empty($fields) ? '*' : $fields;
     $condition['fields'] = $enableCache ? "SQL_CACHE " . $condition['fields'] : $condition['fields'];
     if ($orderBy) {
         $condition['orderby'] = $orderBy;
     }
     if ($groupBy) {
         $condition['groupby'] = $groupBy;
     }
     // 		$condition [ 'limit' ] = $limit;
     // 		$condition [ 'offset' ] = $offset;
     if ($where) {
         $condition['where'] = $where;
     }
     return $this->table->count($condition);
 }
Exemplo n.º 2
0
 /**
  * 按条件统计
  *
  * @example $condition['where'] = array('expression' => 'id < :id', 'value' => array('id' => 10));
  * @param array $condition
  */
 public function countByCondition($condition)
 {
     return $this->table->count($condition);
 }