Final Class Yiisoft\Db\Query\BatchQueryResult
| Inheritance | Yiisoft\Db\Query\BatchQueryResult |
|---|---|
| Implements | Yiisoft\Db\Query\BatchQueryResultInterface |
Represents the result of a batch query execution.
A batch query is a group of many SQL statements that are executed together as a single unit.
Public Methods
Method Details
| public __construct( Yiisoft\Db\Query\QueryInterface $query ): mixed | ||
| $query | Yiisoft\Db\Query\QueryInterface | |
public function __construct(private readonly QueryInterface $query) {}
| public batchSize( integer $value ): Yiisoft\Db\Query\BatchQueryResult | ||
| $value | integer | |
public function batchSize(int $value): static
{
$this->batchSize = $value;
return $this;
}
| public current( ): array |
public function current(): array
{
if ($this->index === -1) {
$this->next();
}
return $this->batch;
}
| public getQuery( ): Yiisoft\Db\Query\QueryInterface |
public function getQuery(): QueryInterface
{
return $this->query;
}
| public indexBy( Closure|string|null $indexBy ): Yiisoft\Db\Query\BatchQueryResult | ||
| $indexBy | Closure|string|null | |
public function indexBy(Closure|string|null $indexBy): static
{
$this->indexBy = $indexBy;
return $this;
}
| public key( ): integer |
public function key(): int
{
if ($this->index === -1) {
$this->next();
}
return $this->index;
}
| public next( ): void |
public function next(): void
{
$this->batch = $this->fetchData();
++$this->index;
}
| public resultCallback( Closure|null $callback ): Yiisoft\Db\Query\BatchQueryResult | ||
| $callback | Closure|null | |
public function resultCallback(?Closure $callback): static
{
$this->resultCallback = $callback;
return $this;
}
| public rewind( ): void |
public function rewind(): void
{
if ($this->index === 0) {
return;
}
$this->dataReader = null;
$this->batch = $this->fetchData();
$this->index = 0;
}
Signup or Login in order to comment.