Get the number of rows in the result set

@return int
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;
    }
135911
private function count()
    {
        if (!$this->withoutTotalResultCount) {
            $qb = $this->cloneQb($this->queryBuilder);
            $this->resetSqlParts($qb, ['select', 'groupBy', 'orderBy'])
                ->setFirstResult(null)
                ->setMaxResults(null)
                ->select(sprintf('COUNT(DISTINCT %s)', $this->aliasDotPrimary()));
            try {
                $this->totalResultCount = $qb->getQuery()->getSingleScalarResult();
            } catch (NonUniqueResultException $e) {
                $this->totalResultCount = 0;
            } catch (\Exception $e) {
                throw new QueryBuilderException($e->getMessage());
            }
        }

        return $this->totalResultCount;
    }
335503
public function getAt(): int
    {
        if ($this->at < 0) {
            return Location::BeforeFirstRow;
        }

        if ($this->at > $this->rowCount()) {
            return Location::AfterLastRow;
        }

        return $this->at;
    }
1298104
public function row()
    {
        if (isset($this->rows[$this->cursor])) {
            return $this->rows[$this->cursor++];
        }

        return false;
    }
453000
public function count(): int
    {
        // If the count is already set, return it
        if(!is_null($this->count)) {
            return $this->count;
        }

        // Maually create a count by looping through the entities. This will
        // trigger the pagination calls to get the correct count of entities
        $count = 0;
        foreach($this as $entity) {
            $count++;
        }

        $this->count = $count;
        return $count;
    }
792227
public function count()
    {
        $query   = $this->query();
        $myQuery = $query instanceof EloquentBuilder ? clone $this->query() : $query;
        if ($query instanceof Collection) {
            return $query->count();
        }

        $finalQuery = $this->applyScopes($myQuery);
        $this->applyGlobalGroupScope($finalQuery);


        // if its a normal query ( no union, having and distinct word )
        // replace the select with static text to improve performance
        $connection = $finalQuery->getQuery()->getConnection();

        if (!Str::contains(Str::lower($finalQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) {

            $row_count = $connection->getQueryGrammar()->wrap('row_count');
            return $connection->table($connection->raw('(' . $finalQuery->toSql() . ') count_row_table'))->select($connection->raw("'1' as {$row_count}"))->setBindings($finalQuery->getBindings())->count();
        }

        return $connection->table($connection->raw('(' . $finalQuery->toSql() . ') count_row_table'))
                        ->setBindings($finalQuery->getBindings())->count();
    }
1304416
public function numRows() {
        if ($this->numRows === null) {
            if ($this->hResult) $this->numRows = pg_num_rows($this->hResult);
            else                $this->numRows = 0;
        }
        return $this->numRows;
    }
339684
public function getCount()
	{
		if ($this->usePaginator()) {
			return (new Paginator($this->getQuery()))->count();
		}
		$data_source = clone $this->data_source;
		$data_source->select(sprintf('COUNT(%s)', $this->checkAliases($this->primary_key)));
		$data_source->resetDQLPart('orderBy');

		return (int) $data_source->getQuery()->getSingleScalarResult();
	}
827829
public function count(): int
    {
        $this->flags['count'] = true;
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        return $pdoStatement->fetchColumn();
    }
908377
public function count()
    {
        $builder = $this->prepareCountQuery();
        $table   = $this->connection->raw('(' . $builder->toSql() . ') count_row_table');

        return $this->connection->table($table)
                                ->setBindings($builder->getBindings())
                                ->count();
    }
726444
public function getAllRowsCount()
    {
        
        if($this->rowscount == -1){
           $this->rowscount = $this->DataSource->getItemCount() ;    
        }        
        return $this->rowscount;
    }
1338747
public function getTotalResults()
    {
        $query = $this->deliverQueryObject();
        $query
            ->resetQueryParts(['groupBy', 'orderBy'])
            ->select('count(distinct p.id)')
            ->setMaxResults(1);
        $result = $query->execute()->fetchColumn();

        return (int) $result;
    }
385635
public function count()
    {
        if ($this->numberOfRows === null) {
            if (is_array($this->rows)) {
                $this->numberOfRows = count($this->rows);
            } else {
                $this->numberOfRows = $this->query->count();
            }
        }
        return $this->numberOfRows;
    }
1174215
public function numRows() {
        if ($this->numRows === null) {
            // no support for num_rows() in SQLite3, need to count manually
            $previous = $this->nextRowIndex;

            while ($this->fetchRow());                          // loop from current position to the end

            // we hit the end
            if ($this->numRows) {
                $this->result->reset();                         // back to start
                $this->nextRowIndex = 0;
                while ($previous--) {                           // loop back to former position
                    $this->fetchRow();
                }
            }
        }
        return $this->numRows;
    }
89127
public function num_rows()
	{
		return is_int($this->num_rows)
			? $this->num_rows
			: $this->num_rows = @sqlite_num_rows($this->result_id);
	}
85192
public function count()
    {
        $myQuery = clone $this->query;

        if (!Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) {
            $row_count = $this->connection->getQueryGrammar()->wrap('row_count');
            $myQuery->select($this->connection->raw("'1' as {$row_count}"));
        }
        return $this->connection->table($this->connection->raw('(' . $myQuery->toSql() . ') count_row_table'))
                        ->setBindings($myQuery->getBindings())->count();
    }
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;
    }