/var/www/vhosts/nabawater/vendor/yiisoft/yii2/db
NameSizeModeActions
conditions/-0755rm
cubrid/-0755rm
mssql/-0755rm
mysql/-0755rm
oci/-0755rm
pgsql/-0755rm
sqlite/-0755rm
ActiveQuery.php315060644editdlrm
ActiveQueryInterface.php45420644editdlrm
ActiveQueryTrait.php63150644editdlrm
ActiveRecord.php297890644editdlrm
ActiveRecordInterface.php212070644editdlrm
ActiveRelationTrait.php232920644editdlrm
AfterSaveEvent.php5530644editdlrm
ArrayExpression.php54000644editdlrm
BaseActiveRecord.php695380644editdlrm
BatchQueryResult.php49050644editdlrm
CheckConstraint.php4580644editdlrm
ColumnSchema.php53560644editdlrm
ColumnSchemaBuilder.php132870644editdlrm
Command.php520260644editdlrm
Connection.php453760644editdlrm
Constraint.php5660644editdlrm
ConstraintFinderInterface.php64540644editdlrm
ConstraintFinderTrait.php112040644editdlrm
DataReader.php85180644editdlrm
DefaultValueConstraint.php4720644editdlrm
Exception.php14570644editdlrm
Expression.php19090644editdlrm
ExpressionBuilder.php7410644editdlrm
ExpressionBuilderInterface.php8600644editdlrm
ExpressionBuilderTrait.php7070644editdlrm
ExpressionInterface.php6150644editdlrm
ForeignKeyConstraint.php9370644editdlrm
IndexConstraint.php5530644editdlrm
IntegrityException.php5460644editdlrm
JsonExpression.php26840644editdlrm
Migration.php269330644editdlrm
MigrationInterface.php12260644editdlrm
PdoValue.php13700644editdlrm
PdoValueBuilder.php6920644editdlrm
Query.php495200644editdlrm
QueryBuilder.php742400644editdlrm
QueryExpressionBuilder.php10440644editdlrm
QueryInterface.php128200644editdlrm
QueryTrait.php151550644editdlrm
Schema.php313770644editdlrm
SchemaBuilderTrait.php114950644editdlrm
SqlToken.php96760644editdlrm
SqlTokenizer.php142080644editdlrm
StaleObjectException.php4470644editdlrm
TableSchema.php31290644editdlrm
Transaction.php93650644editdlrm
ViewFinderTrait.php16140644editdlrm
Edit: /var/www/vhosts/nabawater/vendor/yiisoft/yii2/db/BatchQueryResult.php (4905B)
from('user'); * foreach ($query->batch() as $i => $users) { * // $users represents the rows in the $i-th batch * } * foreach ($query->each() as $user) { * } * ``` * * @author Qiang Xue * @since 2.0 */ class BatchQueryResult extends BaseObject implements \Iterator { /** * @var Connection the DB connection to be used when performing batch query. * If null, the "db" application component will be used. */ public $db; /** * @var Query the query object associated with this batch query. * Do not modify this property directly unless after [[reset()]] is called explicitly. */ public $query; /** * @var int the number of rows to be returned in each batch. */ public $batchSize = 100; /** * @var bool whether to return a single row during each iteration. * If false, a whole batch of rows will be returned in each iteration. */ public $each = false; /** * @var DataReader the data reader associated with this batch query. */ private $_dataReader; /** * @var array the data retrieved in the current batch */ private $_batch; /** * @var mixed the value for the current iteration */ private $_value; /** * @var string|int the key for the current iteration */ private $_key; /** * Destructor. */ public function __destruct() { // make sure cursor is closed $this->reset(); } /** * Resets the batch query. * This method will clean up the existing batch query so that a new batch query can be performed. */ public function reset() { if ($this->_dataReader !== null) { $this->_dataReader->close(); } $this->_dataReader = null; $this->_batch = null; $this->_value = null; $this->_key = null; } /** * Resets the iterator to the initial state. * This method is required by the interface [[\Iterator]]. */ public function rewind() { $this->reset(); $this->next(); } /** * Moves the internal pointer to the next dataset. * This method is required by the interface [[\Iterator]]. */ public function next() { if ($this->_batch === null || !$this->each || $this->each && next($this->_batch) === false) { $this->_batch = $this->fetchData(); reset($this->_batch); } if ($this->each) { $this->_value = current($this->_batch); if ($this->query->indexBy !== null) { $this->_key = key($this->_batch); } elseif (key($this->_batch) !== null) { $this->_key = $this->_key === null ? 0 : $this->_key + 1; } else { $this->_key = null; } } else { $this->_value = $this->_batch; $this->_key = $this->_key === null ? 0 : $this->_key + 1; } } /** * Fetches the next batch of data. * @return array the data fetched */ protected function fetchData() { if ($this->_dataReader === null) { $this->_dataReader = $this->query->createCommand($this->db)->query(); } $rows = []; $count = 0; while ($count++ < $this->batchSize && ($row = $this->_dataReader->read())) { $rows[] = $row; } return $this->query->populate($rows); } /** * Returns the index of the current dataset. * This method is required by the interface [[\Iterator]]. * @return int the index of the current row. */ public function key() { return $this->_key; } /** * Returns the current dataset. * This method is required by the interface [[\Iterator]]. * @return mixed the current dataset. */ public function current() { return $this->_value; } /** * Returns whether there is a valid dataset at the current position. * This method is required by the interface [[\Iterator]]. * @return bool whether there is a valid dataset at the current position. */ public function valid() { return !empty($this->_batch); } }