PHP Classes

File: src/query/CountQuery.php

Recommend this page to a friend!
  Classes of Vitaly  >  Queasy DB  >  src/query/CountQuery.php  >  Download  
File: src/query/CountQuery.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Queasy DB
Execute queries by accessing class variables
Author: By
Last change:
Date: 1 year ago
Size: 657 bytes


Class file image Download

namespace queasy\db\query;

CountQuery extends TableQuery
     * Executes SQL query and returns all selected rows.
     * @param array $params Query parameters
     * @return int Count of records found
     * @throws DbException On error
public function run(array $params = array(), array $options = array())
$this->setSql(sprintf('SELECT count(*) FROM `%s` WHERE `%s` = :%2$s', $this->tableName(), key($params)))
$this->setSql(sprintf('SELECT count(*) FROM `%s`', $this->tableName()));

parent::run($params, $options);