Allow BatchRowIterator to also set query options.
Change-Id: I15927c5b7f1edcfb40edd3cda9257b40d0276073
This commit is contained in:
parent
c7eb4d9c83
commit
4dfb6997e9
1 changed files with 14 additions and 1 deletions
|
|
@ -77,6 +77,11 @@ class BatchRowIterator implements RecursiveIterator {
|
|||
*/
|
||||
private $key;
|
||||
|
||||
/**
|
||||
* @var array Additional query options
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* @param IDatabase $db The database to read from
|
||||
* @param string|array $table The name or names of the table to read from
|
||||
|
|
@ -104,6 +109,14 @@ class BatchRowIterator implements RecursiveIterator {
|
|||
$this->conditions = array_merge( $this->conditions, $conditions );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options Query options suitable for use with
|
||||
* IDatabase::select
|
||||
*/
|
||||
public function addOptions( array $options ) {
|
||||
$this->options = array_merge( $this->options, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $conditions Query join conditions suitable for use
|
||||
* with IDatabase::select
|
||||
|
|
@ -199,7 +212,7 @@ class BatchRowIterator implements RecursiveIterator {
|
|||
[
|
||||
'LIMIT' => $this->batchSize,
|
||||
'ORDER BY' => $this->orderBy,
|
||||
],
|
||||
] + $this->options,
|
||||
$this->joinConditions
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue