MediaWiki
master
|
Public Member Functions | |
__construct (IDatabase $db, $table, $primaryKey, $batchSize) | |
addConditions (array $conditions) | |
addJoinConditions (array $conditions) | |
addOptions (array $options) | |
current () | |
extractPrimaryKeys ( $row) | |
Extracts the primary key(s) from a database row. More... | |
getChildren () | |
hasChildren () | |
key () | |
next () | |
Fetch the next set of rows from the database. More... | |
rewind () | |
Reset the iterator to the begining of the table. More... | |
setFetchColumns (array $columns) | |
valid () | |
Protected Member Functions | |
buildConditions () | |
Uses the primary key list and the maximal result row from the previous iteration to build an SQL condition sufficient for selecting the next page of results. More... | |
buildGreaterThanCondition (array $quotedMaximumValues) | |
Given an array of column names and their maximum value generate an SQL condition where all keys except the last match $quotedMaximumValues exactly and the last column is greater than the matching value in $quotedMaximumValues. More... | |
Protected Attributes | |
$batchSize | |
$conditions = [] | |
$db | |
$fetchColumns | |
array | $joinConditions = [] |
array | $options = [] |
Additional query options. More... | |
$orderBy | |
$primaryKey | |
$table | |
Private Attributes | |
$current = [] | |
int | $key |
key 0-indexed number of pages fetched since self::reset() More... | |
Definition at line 29 of file BatchRowIterator.php.
BatchRowIterator::__construct | ( | IDatabase | $db, |
$table, | |||
$primaryKey, | |||
$batchSize | |||
) |
IDatabase | $db | The database to read from |
string | array | $table | The name or names of the table to read from |
string | array | $primaryKey | The name or names of the primary key columns |
int | $batchSize | The number of rows to fetch per iteration |
InvalidArgumentException |
Definition at line 95 of file BatchRowIterator.php.
References $batchSize, $db, $primaryKey, and $table.
BatchRowIterator::addConditions | ( | array | $conditions | ) |
array | $conditions | Query conditions suitable for use with IDatabase::select |
Definition at line 111 of file BatchRowIterator.php.
Referenced by CategoryChangesAsRdf\addTimestampConditions().
BatchRowIterator::addJoinConditions | ( | array | $conditions | ) |
array | $conditions | Query join conditions suitable for use with IDatabase::select |
Definition at line 127 of file BatchRowIterator.php.
BatchRowIterator::addOptions | ( | array | $options | ) |
array | $options | Query options suitable for use with IDatabase::select |
Definition at line 119 of file BatchRowIterator.php.
Referenced by CategoryChangesAsRdf\addIndex().
|
protected |
Uses the primary key list and the maximal result row from the previous iteration to build an SQL condition sufficient for selecting the next page of results.
All except the final key use =
conditions while the final key uses a >
condition
Example output: [ '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' ]
Definition at line 241 of file BatchRowIterator.php.
References $conditions, buildGreaterThanCondition(), and current().
Referenced by next().
|
protected |
Given an array of column names and their maximum value generate an SQL condition where all keys except the last match $quotedMaximumValues exactly and the last column is greater than the matching value in $quotedMaximumValues.
array | $quotedMaximumValues | The maximum values quoted with $this->db->addQuotes() |
Definition at line 284 of file BatchRowIterator.php.
References $conditions, and $keys.
Referenced by buildConditions().
BatchRowIterator::current | ( | ) |
Definition at line 165 of file BatchRowIterator.php.
References $current.
Referenced by buildConditions(), getChildren(), hasChildren(), next(), and rewind().
BatchRowIterator::extractPrimaryKeys | ( | $row | ) |
Extracts the primary key(s) from a database row.
stdClass | $row | An individual database row from this iterator |
Definition at line 153 of file BatchRowIterator.php.
BatchRowIterator::getChildren | ( | ) |
BatchRowIterator::hasChildren | ( | ) |
Definition at line 195 of file BatchRowIterator.php.
References current().
array $primaryKey The name of the primary BatchRowIterator::key | ( | ) |
Definition at line 172 of file BatchRowIterator.php.
References $key.
BatchRowIterator::next | ( | ) |
Fetch the next set of rows from the database.
Definition at line 209 of file BatchRowIterator.php.
References $res, buildConditions(), current(), and key().
Referenced by rewind().
BatchRowIterator::rewind | ( | ) |
Reset the iterator to the begining of the table.
Definition at line 179 of file BatchRowIterator.php.
BatchRowIterator::setFetchColumns | ( | array | $columns | ) |
array | $columns | List of column names to select from the table suitable for use with IDatabase::select() |
Definition at line 135 of file BatchRowIterator.php.
BatchRowIterator::valid | ( | ) |
Definition at line 188 of file BatchRowIterator.php.
References $current.
|
protected |
Definition at line 49 of file BatchRowIterator.php.
Referenced by __construct().
|
protected |
Definition at line 55 of file BatchRowIterator.php.
Referenced by buildConditions(), and buildGreaterThanCondition().
|
private |
Definition at line 76 of file BatchRowIterator.php.
|
protected |
Definition at line 34 of file BatchRowIterator.php.
Referenced by __construct().
|
protected |
Definition at line 66 of file BatchRowIterator.php.
|
protected |
Definition at line 60 of file BatchRowIterator.php.
|
private |
key 0-indexed number of pages fetched since self::reset()
Definition at line 81 of file BatchRowIterator.php.
Referenced by key().
|
protected |
Additional query options.
Definition at line 86 of file BatchRowIterator.php.
|
protected |
Definition at line 71 of file BatchRowIterator.php.
|
protected |
Definition at line 44 of file BatchRowIterator.php.
Referenced by __construct().
|
protected |
Definition at line 39 of file BatchRowIterator.php.
Referenced by __construct().