Returns the number of the rows fetched by the last retrieving query.

@return int|false
Returns the number of the rows fetched by the last retrieving query. In the case
of any error returns false.

@author Oleg Schildt
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;
    }
837715
public function count()
    {
        $this->assembleQueryWithJoins();
        $q = clone $this->source;
        $q = $q->resetDQLPart('orderBy')->select('COUNT(' . $this->currentAlias . ')')->getQuery();
        return $q->getSingleScalarResult();
    }
726444
public function getAllRowsCount()
    {
        
        if($this->rowscount == -1){
           $this->rowscount = $this->DataSource->getItemCount() ;    
        }        
        return $this->rowscount;
    }
651116
public function loadNextRow()
    {
        $this->connect();

        // Execute the query and get the result set cursor.
        if (!$this->executed) {
            if (!($this->execute())) {
                return $this->errorNum ? null : false;
            }
        }

        // Get the next row from the result set as an object of type $class.
        if ($row = $this->fetchArray()) {
            return $row;
        }

        // Free up system resources and return.
        $this->freeResult();

        return false;
    }
939193
public function count() {
        $sql    = $this->getSQL();
        $values = $this->values;
        if ($sql) {
            try {
                $statement = $this->dialect->prepare($sql);
                foreach ($values as $value) {
                    list ($name, $val, $type) = $value;
                    if (!$statement->bindValue($name, $val, $type)) {
                        $this->errorSQL    = $sql;
                        $this->errorValues = $values->__toString();
                        $this->error       = 'can not bind the value ' . $val . '[' . $type . '] to the argument:' . $name;

                        return false;
                    }
                }
                $rst = $statement->execute();
                $cnt = false;
                if ($rst) {
                    $cnt = $statement->rowCount();
                } else {
                    $this->dumpSQL($statement);
                }
                if ($statement) {
                    $statement->closeCursor();
                    $statement = null;
                }
                QueryBuilder::addSqlCount();

                return $cnt;
            } catch (\PDOException $e) {
                $this->exception   = $e;
                $this->error       = $e->getMessage();
                $this->errorSQL    = $sql;
                $this->errorValues = $values->__toString();

                return false;
            }
        } else {
            $this->error       = 'Can not generate the delete SQL';
            $this->errorSQL    = '';
            $this->errorValues = $values->__toString();
        }

        return false;
    }
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;
    }
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'];
    }
602672
public function GetNumberOfHits()
    {
        if ($this->fieldNumberOfRecordsFound < 0) {
            $query = "SELECT COUNT(*) AS recs FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
            if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
                $this->fieldNumberOfRecordsFound = $row['recs'];
                $this->sqlData['number_of_records_found'] = $this->fieldNumberOfRecordsFound;
                $this->AllowEditByAll(true);
                $this->Save();
            }
        }

        return $this->fieldNumberOfRecordsFound;
    }
813382
public function getTotal()
    {
        $query = clone $this->getQuery();
        $query->order = null;
        $query->limit = null;

        return $query->fetchValue('COUNT(*)');
    }
437756
public function getCount()
    {
        if ($this->_count !== null) {
            return $this->_count;
        }

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

        return $this->_length;
    }
615053
private function obtainNumRows()
    {
        $count = 0;
        while (false !== $this->stmt->fetch(PDO::FETCH_NUM)) {
            $count = $count + 1;
        }
        $this->stmt->execute();
        return $count;
    }
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;
    }
124326
protected function _fetchResult()
    {
        if (!$this->_statement) {
            return false;
        }

        $row = $this->_statement->fetch('assoc');
        if ($row === false) {
            return $row;
        }

        return $this->_groupResult($row);
    }
929866
public function rowCount()
    {
        if (!$this->_stmt) {
            return false;
        }

        if (!$this->_executed) {
            return 0;
        }

        $num_rows = sqlsrv_rows_affected($this->_stmt);

        // Strict check is necessary; 0 is a valid return value
        if ($num_rows === false) {
            // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
            throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
        }

        return $num_rows;
    }
1326403
public function getRow(){
			if($GLOBALS['CONN']->_connectionID==false){
				return false;
			}
			$s=$this->getQuery();
			return $s->FetchRow();
		}
1353791
public function fetch()
    {
        if ($row = mysql_fetch_array($this->query)) {
            return $row;
        } else if ($this->size() > 0) {
            mysql_data_seek($this->query, 0);
            return false;
        } else {
            return false;
        }
    }
782554
protected function getQueryResultRow()
    {
        if ($this->fetchedResults === null) {
            $this->fetchedResults = $this
                ->getQueryResult()
                ->fetchAll();
        }

        return array_shift($this->fetchedResults);
    }