Get the number of affected rows for the previous executed SQL statement.
Only applicable for DELETE, INSERT, or UPDATE statements.

@param  \PDOStatement $cursor

@return int The number of affected rows.

@since   2.0
771952
public function countAffected($cursor = null)
    {
        if (!$cursor instanceof \PDOStatement) {
            $cursor = $this->getCursor();
        }

        if (!$cursor) {
            return 0;
        }

        return $cursor->rowCount();
    }
328304
public function checkAffected(PDOStatement $statement, \Exception $exceptionToThrow = null)
    {
        if (!$exceptionToThrow instanceof \Exception) {
            $exceptionToThrow = new NoRecordsAffectedException();
        }
        if (!boolval($statement->rowCount()) && $this->getIsStrict()) {
            throw $exceptionToThrow;
        }
        return true;
    }
926035
protected function GetRemainingRowCount()
    {
        $aTableList = $this->aTablesToProcess;
        $iCount = 0;
        foreach ($aTableList as $iWorkId) {
            $oIndexQuery = TdbShopSearchQuery::GetNewInstance();
            /** @var $oIndexQuery TdbShopSearchQuery */
            if ($oIndexQuery->Load($iWorkId)) {
                $iCount = $iCount + $oIndexQuery->NumberOfRecordsLeftToIndex();
            }
        }

        return $iCount;
    }
1199238
public static function count($where = null): int
    {
        $select = static::select();

        if ($where !== null) {
            if ($where instanceof Where) {
                $select->field('COUNT(*)', 'total');
                $select->where(clone $where);

            } else if (is_array($where)) {
                $select->field('COUNT(*)', 'total');
                foreach ($where as $field => $value) {
                    $select->where($field, $value);
                }

            } else if (!is_array(static::$primaryKey) && (is_numeric($where) || is_string($where))) {
                $select->field('COUNT(' . static::$primaryKey . ')', 'total');
                $select->where(static::$primaryKey, $where);

            }
        } else {
            $pk = is_string(static::$primaryKey) ? static::$primaryKey : '*';
            $select->field('COUNT(' . $pk . ')', 'total');
        }

        $results = $select->fetchAll();

        if (isset($results[0])) {
            $r = $results[0];
            if (array_key_exists('total', $r)) {
                return (int)$r['total'];
            } else {
                return 0;
            }
        } else {
            return 0;
        }
    }
3485
public function numAffectedRows()
    {
        if( !isset( $this->affectedRows ) ) {
            $this->affectedRows = pg_affected_rows( $this->resource );
        }
        return $this->affectedRows;
    }
544383
public static function cursorToOffset($cursor)
    {
        $offset = substr(base64_decode($cursor), strlen(self::PREFIX));
        if (is_numeric($offset)){
            return intval($offset);
        } else {
            return null;
        }
    }
156366
private function obtainNumRows()
    {
        $count = 0;
        if (false !== $this->internalFetch(SQLITE3_NUM)) {
            $this->getFields();
            $count = 1;
        }
        while (false !== $this->internalFetch(SQLITE3_NUM)) {
            $count = $count + 1;
        }
        $this->internalReset();
        return $count;
    }
615053
private function obtainNumRows()
    {
        $count = 0;
        while (false !== $this->stmt->fetch(PDO::FETCH_NUM)) {
            $count = $count + 1;
        }
        $this->stmt->execute();
        return $count;
    }
991295
private function count()
    {
        $qb = clone $this->queryBuilder;
        $this->resetSqlParts($qb, ['orderBy'])
            ->setFirstResult(null)
            ->setMaxResults(null);
        $connection = $qb->getConnection();
        $sql = sprintf("SELECT COUNT(*) FROM (%s) _sps_cnt_", $qb->getSQL());
        $stmt = $connection->executeQuery($sql, $qb->getParameters(), $this->parametersTypes);
        $this->totalResultCount = $stmt->fetchColumn();

        return $this->totalResultCount;
    }
1326229
def _produce_return(self, cursor):
        
        rowcount = cursor.rowcount

        # Check the row count?
        if self._rowcount is not None and self._rowcount != rowcount:
            raise ManipulationCheckError(
                "Count was {}, expected {}.".format(rowcount, self._rowcount))

        return rowcount
705965
public function getAffectedRows()
    {
        $affectedRows = 0;

        if (!is_null($this->resourceHandle)) {
            $affectedRows = $this->resourceHandle->rowCount();
        }

        return $affectedRows;
    }
1074542
protected function freeResult($cursor = null)
	{
		$this->executed = false;

		if ($cursor instanceof \mysqli_result)
		{
			$cursor->free_result();
		}

		if ($this->prepared instanceof \mysqli_stmt)
		{
			$this->prepared->close();
			$this->prepared = null;
		}
	}
719631
public function count($table = '', $where = '')
    {
        // if table name not pass
        if (!empty($table)) {
            if (empty($where)) {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table`;"; // create count query
            } else {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table` WHERE $where;";  // create count query
            }

            // pdo prepare statement
            $this->STH = $this->prepare($this->sql);

            try {
                if ($this->STH->execute()) {
                    // fetch array result
                    $this->results = $this->STH->fetch();
                    // close pdo
                    $this->STH->closeCursor();
                    // return number of count
                    return $this->results['NUMROWS'];
                } else {
                    self::error($this->STH->errorInfo());
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            }
        } else {
            self::error('Table name not found..');
        }
    }
497713
public function numberOfRows()
    {
        if (isset($this->statement)) {
            $this->statement->store_result();
            return $this->statement->num_rows ?: $this->statement->affected_rows;
        } else if (isset($this->result)) {
            return $this->result->num_rows;
        } else {
            throw new Exception('Error: The database result resource is not currently set.');
        }
    }
920730
public function affectingStatement($query, $bindings = array())
    {
        return $this->run($query, $bindings, function ($me, $query, $bindings)
        {
            if ($me->pretending()) return 0;

            $bindings = $me->prepareBindings($bindings);

            //
            $statement = $me->createPdoStatement($query);

            $statement->execute($bindings);

            return $statement->rowCount();
        });
    }
1233560
public function count($field = '*')
    {
        if ($this->_union) {
            throw new NotSupportedException('Union query is not support to get total rows');
        }

        $copy = clone $this;

        $copy->_fields = "COUNT($field) as [row_count]";
        $copy->_limit = null;
        $copy->_offset = null;
        $copy->_order = null;
        $copy->_index = null;

        $copy->_sql = $copy->_buildSql();

        if ($copy->_group === null) {
            $result = $copy->getConnection()->fetchOne($copy->_sql, $copy->_bind);

            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
            $rowCount = (int)$result['row_count'];
        } else {
            $result = $copy->getConnection()->fetchAll($copy->_sql, $copy->_bind);
            $rowCount = count($result);
        }

        return $rowCount;
    }
984112
protected function getPdoStatement()
    {
        $statement = $this->connection->prepare($this->getSql());
        if ($this->dataRowClass !== null) {
            $statement->setFetchMode(PDO::FETCH_CLASS, $this->dataRowClass);
        } else {
            $statement->setFetchMode(PDO::FETCH_OBJ);
        }
        return $statement;
    }