Retrieve the number of results for the generated query - used
in place of the get() method

@param string $table
@param boolean $reset
@return int
482903
public function countAllResults(string $table='', bool $reset = TRUE): int
	{
		// Set the table
		if ( ! empty($table))
		{
			$this->from($table);
		}

		$result = $this->_run('get', $table, NULL, NULL, $reset);
		$rows = $result->fetchAll();

		return (int) count($rows);
	}
1126438
public function count(): ?int
    {
        // no where, count all simply
        $where = $this->query['where'] ?? null;
        if ($where == null) {
            return $this->agent->count($this->table);
        }

        $from = '';
        if ($this->query) {
            $isSub = $this->isSub;
            $this->isSub = true;
            $from = $this->toString();
            $this->isSub = $isSub; // restore
        }

        if ($from == '') {
            $from = "SELECT 1 FROM {$this->table} ". trim($this->toQueryString('where', false));
        }
        $from = trim($from);

        $query = "SELECT count(*) AS count FROM (\n\t{$from}\n) AS tmp";
        $result = $this->agent->get($query, null, 'object');

        return isset($result->count) ? intval($result->count) : null;
    }
657122
public function count($columns = '*')
    {
        $result = $this->getBuilder()->count($columns);

        // Reset query builder
        $this->resetBuilder();

        return (int) $result;
    }
399146
public static function q_check(string $table, string $where = ''): bool
    {
        return (bool)self::getInstance()->sql_query('SELECT NULL FROM `' . $table . '`' . ($where ? ' WHERE ' . $where : '') . ' LIMIT 1')->rowCount();
    }
767368
public function deleteFrom(string $table, array $where): int
    {
        $delete = new Delete($this->options);
        $sqlParams = $delete->buildQuery($table, $where);
        return $this->query($sqlParams->getSql(), $sqlParams->getParams())->getAffected();
    }
41788
public function qbr($table, $mixed = array()) {
        $mixed["Limit"] = 1;
        $res = $this->qb($table, $mixed);
        while ($row = DB::f($res)) {
            return $row;
        }
        return false;
    }
444532
public static function count($sql)
    {
        $data = self::query($sql);
        $result = $data->fetchAll(PDO::FETCH_ASSOC);
        //
        return  $result ? count($result) : -1;
    }
789222
public function count($terms = null)
    {
        if (!$this->table()) {
            return 0;
        }

        $query = $this->select(['count(*) count']);

        $this->normalizeTerms($query, $terms);

        return (int) $query->execute()->fetch()['count'];
    }
715921
public function getAge(Tables $tables): int
    {
        return $tables->getRacesTable()->getAge($this->getRaceCode(), $this->getSubRaceCode());
    }
1146686
function reset($Ensure = false)
	{
		if ($Ensure !== true)
		{
			throw new \Exception ("You must pass true to this function, otherwise it won't work.");
			return;
		}
		$res = Jf::sql ( "DELETE FROM {$this->tablePrefix()}{$this->type()}" );
		$Adapter = get_class(Jf::$Db);
		if ($this->isMySql())
			Jf::sql ( "ALTER TABLE {$this->tablePrefix()}{$this->type()} AUTO_INCREMENT=1 " );
		elseif ($this->isSQLite())
			Jf::sql ( "delete from sqlite_sequence where name=? ", $this->tablePrefix () . "{$this->type()}" );
		else
			throw new \Exception ( "Rbac can not reset table on this type of database: {$Adapter}" );
		$iid = Jf::sql ( "INSERT INTO {$this->tablePrefix()}{$this->type()} (Title,Description,Lft,Rght) VALUES (?,?,?,?)", "root", "root",0,1 );
		return (int)$res;
	}
1024329
public function count( $where = 'all', $options = array() )
	{

		$dbr = wfGetDB( DB_SLAVE );

		if ( !is_array( $where ) && $where == 'all' ) {

			/* Fetch all entities */
			$collection = $dbr->select( static::$table,
				'id',
				array(),
				__METHOD__,
				$options
			);

		} else {

			/* Fetch conditional entities */
			$collection = $dbr->select( static::$table,
				'id',
				$where,
				__METHOD__,
				$options
			);

		}

		/* Check result */
		if ( !$collection ) return 0;

		$count = $dbr->numRows( $collection );

		return $count;

	}
163979
public function getCompiledInsert(string $table, bool $reset=TRUE): string
	{
		return $this->_getCompile('insert', $table, $reset);
	}
1255605
public function getCompiledDelete(string $table='', bool $reset=TRUE): string
	{
		return $this->_getCompile('delete', $table, $reset);
	}
446494
public function count()
    {
        $ret = $this->conn()->selectCollection($this->table_name)->count($this->where);
        $this->sql = array('table'=> $this->table_name,'where'=>$this->where);

        $this->_clear_var();
        return $ret;
    }
1039863
public function count($with_deleted = null)
    {
        if (false === $this->has_table()) return false;

        if ($this->count === 0) {
            $with_deleted !== null or $with_deleted = (! $this->is_destructive);

            if (false === $with_deleted) {
                $db = $this->db->where($this->deletion_key, 0);
            }

            $this->count = $db->count_all_results($this->table);
        }

        return $this->count;
    }
322053
public function countAll($column = '*')
    {
        $results = $this->db->get($this->table, NULL, $column);

        return (int) count($results);
    }
495389
public function count()
    {

        switch ($this->mode) {

            case "mysql":
                $rows = $this->result->num_rows;
                break;

            case "postgres":
            case "redshift":
                $rows = pg_num_rows($this->result);
                break;

            case "odbc":
                $rows = odbc_num_rows($this->result);

                # The above function is unreliable, so if we got a zero count then double check it
                if ($rows < 1) {
                    $rows = 0;

                    /**
                     * If it is an update/delete then we just have to trust the odbc_num_rows() result,
                     * however it is some kind of select, then we can manually count the rows returned.
                     */
                    if (odbc_num_fields($this->result) > 0) {
                        $position = $this->position;
                        $this->seek(0);
                        while ($this->getNextRow()) {
                            ++$rows;
                        }
                        $this->seek($position);
                    }
                }
                break;

            case "sqlite":
                $rows = 0;
                while ($this->result->fetchArray()) {
                    $rows++;
                }
                $this->seek($this->position);
                break;

            case "mssql":
                $rows = mssql_num_rows($this->result);
                break;

            case "mssqlsrv":
                $rows = sqlsrv_num_rows($this->result);
                break;
        }

        if ($rows === false || $rows < 0) {
            throw new \Exception("Failed to get the row count from the result set");
        }

        return $rows;
    }