Get the total number of results in the cursor

This might issue additional HTTP requests to fetch any outstanding
results from the server

@throws Exception
@return int - total number of results
437756
public function getCount()
    {
        if ($this->_count !== null) {
            return $this->_count;
        }

        while ($this->_hasMore) {
            $this->fetchOutstanding();
        }

        return $this->_length;
    }
1121904
public function count()
    {
        $this->select("COUNT(" . $this->getPrimaryKey() . ") as count");

        try {
            $results = $this->query();
        } catch (\PDOException $e) {

            throw new DatabaseException($e->getMessage() . '<br>' . $this->getLastQuery()[0]);
        }

        $results = $results->fetchAssoc();

        return $results[0]['count'];
    }
431959
public function fetched_count()
    {
        if ($this->statement) {
            return $this->statement->num_rows;
        }
        
        if (!$this->mysqli_result) {
            $this->last_error_id = "db_result_error";
            return false;
        }
        
        // by update, insert, delete it is not an object
        // by select it is an object
        // crazy!
        
        if (!is_object($this->mysqli_result)) {
            return false;
        }
        
        return $this->mysqli_result->num_rows;
    }
1088423
public function getTotal()
    {
        $query = $this->getQuery()->select('COUNT(*) as total');

        $rows = $this->database->query($query, $this->database->getBinds());

        if (!isset($rows[0]['total'])) {
            return 0;
        }

        return $rows[0]['total'];
    }
1047018
public function count()
    {
        if (empty($this->queryString)) {
            $builder = clone $this->builder;
            $builder->resetQueryPart('orderBy');
            $stmt = $builder->execute();
        } else {
            $stmt = $this->connection->executeQuery($this->queryString, $this->queryParams);
        }

        return (int) $stmt->rowCount();
    }
1064185
public function count()
    {
        if (isset($this->_resultset)) {
            return $this->_resultset->count();
        } elseif (isset($this->_limit) || isset($this->_group)) {
            return $this->execute()->count();
        } else {
            $query = clone $this;

            return (int)$query->select("count(*) count")->execute()->scalar();
        }
    }
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;
    }
1161482
public function getTotal()
  {
    $rawQuery = "SELECT count(*) as total FROM orders";

    // Perform the raw query.
    $rawResults = DB::select( DB::raw($rawQuery) );

    // Return the total.
    return $rawResults[0]->total;
  }
814086
@InterfaceAudience.Public
    public int getTotalRows() {
        try {
            updateIndex();
        } catch (CouchbaseLiteException e) {
            Log.e(Log.TAG_VIEW, "Update index failed when getting the total rows", e);
        }
        return getCurrentTotalRows();
    }
813382
public function getTotal()
    {
        $query = clone $this->getQuery();
        $query->order = null;
        $query->limit = null;

        return $query->fetchValue('COUNT(*)');
    }
833930
public function getNbResults()
    {
        if (isset($this->nbResults)) {
            return $this->nbResults;
        }

        $countQuery = clone $this->query;
        $countQuery->limit = 0;

        return $this->nbResults = $this->searchService->findLocations($countQuery)->totalCount;
    }
905225
public function getCountSQL()
        {
            if (!$this->query->getTable() instanceof Table) {
                throw new Exception('Trying to generate sql when no table is being used.');
            }
            $sql = $this->generateCountSQL();
            $sql .= $this->generateJoinSQL();
            $sql .= $this->generateWhereSQL();

            return $sql;
        }
208101
private function totalRecordsQuery(): int
    {
        return $this->totalIndividualsQuery()
            + $this->totalFamiliesQuery()
            + $this->totalNotesQuery()
            + $this->totalRepositoriesQuery()
            + $this->totalSourcesQuery();
    }
56952
public function count()
    {
        try {
            $originalQuery = $this->queryBuilder->getQuery();
            $dqlQuery = clone $originalQuery;
            $dqlQuery->setParameters($originalQuery->getParameters());
            $dqlQuery->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_TREE_WALKERS, [CountWalker::class]);
            $offset = $dqlQuery->getFirstResult();
            $limit = $dqlQuery->getMaxResults();
            if ($offset !== null) {
                $dqlQuery->setFirstResult(null);
            }
            $numberOfResults = (int)$dqlQuery->getSingleScalarResult();
            if ($offset !== null) {
                $numberOfResults = max(0, $numberOfResults - $offset);
            }
            if ($limit !== null) {
                $numberOfResults = min($numberOfResults, $limit);
            }
            return $numberOfResults;
        } catch (\Doctrine\ORM\ORMException $ormException) {
            $message = $this->throwableStorage->logThrowable($ormException);
            $this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
            return 0;
        } catch (\PDOException $pdoException) {
            throw new Exception\DatabaseConnectionException($pdoException->getMessage(), $pdoException->getCode());
        }
    }
431514
public function count()
    {
        $this->countQuery->execute();
        $res = $this->countQuery->fetchColumn();
        $this->countQuery->closeCursor();
        return (int) $res;
    }
352774
protected function fetch_cursor_block() {
        if ($this->result) {
            throw new coding_exception('Unexpected non-empty result when fetching from cursor');
        }
        list($this->result, $this->lastbatch) = $this->db->fetch_from_cursor($this->cursorname);
        if (!$this->result) {
            throw new coding_exception('Unexpected failure when fetching from cursor');
        }
    }
213035
public long count() throws Exception {
		final String id = new AbstractID().toString();

		output(new Utils.CountHelper<T>(id)).name("count()");

		JobExecutionResult res = getExecutionEnvironment().execute();
		return res.<Long> getAccumulatorResult(id);
	}