Gdn_SQLDriver::getCount PHP Méthode

getCount() public méthode

Returns the total number of records in the specified table.
public getCount ( string $Table = '', mixed $Where = false )
$Table string The table from which to count rows of data.
$Where mixed Adds to the $this->_Wheres collection using $this->Where();
    public function getCount($Table = '', $Where = false)
    {
        if ($Table != '') {
            //$this->MapAliases($Table);
            $this->from($Table);
        }
        if ($Where !== false) {
            $this->where($Where);
        }
        $this->select('*', 'count', 'RowCount');
        // count * slow on innodb
        $Sql = $this->getSelect();
        $Result = $this->query($Sql);
        $CountData = $Result->firstRow();
        return $CountData->RowCount;
    }