MediaWiki REL1_39
|
Result wrapper for grabbing data queried from an IDatabase object. More...
Public Member Functions | |
count () | |
Get the number of rows in a result object. | |
current () | |
fetchObject () | |
Fetch the next row from the given result object, in object form. | |
fetchRow () | |
Fetch the next row from the given result object, in associative array form. | |
free () | |
Free a result object. | |
getFieldNames () | |
Get the names of the fields in the result. | |
key () | |
next () | |
numRows () | |
Get the number of rows in a result object. | |
rewind () | |
seek ( $pos) | |
Change the position of the cursor in a result object. | |
valid () | |
Protected Member Functions | |
doFetchObject () | |
Get the next row as a stdClass object, or false if iteration has proceeded past the end. | |
doFetchRow () | |
Get the next row as an array containing the data duplicated, once with string keys and once with numeric keys, per the PDO::FETCH_BOTH convention. | |
doFree () | |
Free underlying data. | |
doGetFieldNames () | |
Get the field names in the result set. | |
doNumRows () | |
Get the number of rows in the result set. | |
doSeek ( $pos) | |
Modify the current cursor position to the row with the specified offset. | |
Protected Attributes | |
int | $currentPos = 0 |
The offset of the current row that would be returned by current() and may have been previously returned by fetchObject(). | |
stdClass array bool null | $currentRow |
The row at $this->currentPos, or null if it has not yet been retrieved, or false if the current row was past the end. | |
int | $nextPos = 0 |
The offset of the row that would be returned by the next call to fetchObject(). | |
Result wrapper for grabbing data queried from an IDatabase object.
Only IDatabase-related classes should construct these. Other code may use the FakeResultWrapper class for convenience or compatibility shims.
Note that using the Iterator methods in combination with the non-Iterator IDatabase result iteration functions may cause rows to be skipped or repeated.
By default, this will use the iteration methods of the IDatabase handle if provided. Subclasses can override methods to make it solely work on the result resource instead.
Definition at line 23 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::count | ( | ) |
Get the number of rows in a result object.
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 98 of file ResultWrapper.php.
Referenced by Wikimedia\Rdbms\FakeResultWrapper\doNumRows(), and Wikimedia\Rdbms\SqliteResultWrapper\doNumRows().
Wikimedia\Rdbms\ResultWrapper::current | ( | ) |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 139 of file ResultWrapper.php.
|
abstractprotected |
Get the next row as a stdClass object, or false if iteration has proceeded past the end.
The offset within the result set is in $this->currentPos.
Reimplemented in Wikimedia\Rdbms\FakeResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper, Wikimedia\Rdbms\PostgresResultWrapper, and Wikimedia\Rdbms\SqliteResultWrapper.
|
abstractprotected |
Get the next row as an array containing the data duplicated, once with string keys and once with numeric keys, per the PDO::FETCH_BOTH convention.
Or false if iteration has proceeded past the end.
Reimplemented in Wikimedia\Rdbms\FakeResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper, Wikimedia\Rdbms\PostgresResultWrapper, and Wikimedia\Rdbms\SqliteResultWrapper.
|
abstractprotected |
Free underlying data.
It is not necessary to do anything.
Reimplemented in Wikimedia\Rdbms\FakeResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper, Wikimedia\Rdbms\PostgresResultWrapper, and Wikimedia\Rdbms\SqliteResultWrapper.
|
abstractprotected |
Get the field names in the result set.
Reimplemented in Wikimedia\Rdbms\FakeResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper, Wikimedia\Rdbms\PostgresResultWrapper, and Wikimedia\Rdbms\SqliteResultWrapper.
|
abstractprotected |
Get the number of rows in the result set.
Reimplemented in Wikimedia\Rdbms\FakeResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper, Wikimedia\Rdbms\PostgresResultWrapper, and Wikimedia\Rdbms\SqliteResultWrapper.
Referenced by Wikimedia\Rdbms\ResultWrapper\numRows().
|
abstractprotected |
Modify the current cursor position to the row with the specified offset.
If $pos is out of bounds, the behaviour is undefined.
int | $pos |
Reimplemented in Wikimedia\Rdbms\FakeResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper, Wikimedia\Rdbms\PostgresResultWrapper, and Wikimedia\Rdbms\SqliteResultWrapper.
Wikimedia\Rdbms\ResultWrapper::fetchObject | ( | ) |
Fetch the next row from the given result object, in object form.
Fields can be retrieved with $row->fieldname, with fields acting like member variables. If no more rows are available, false is returned.
DBUnexpectedError | Thrown if the database returns an error |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 102 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::fetchRow | ( | ) |
Fetch the next row from the given result object, in associative array form.
Fields are retrieved with $row['fieldname']. If no more rows are available, false is returned.
DBUnexpectedError | Thrown if the database returns an error |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 108 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::free | ( | ) |
Free a result object.
This either saves memory in PHP (buffered queries) or on the server (unbuffered queries). In general, queries are not large enough in result sets for this to be worth calling.
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 129 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::getFieldNames | ( | ) |
Get the names of the fields in the result.
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 160 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::key | ( | ) |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 147 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::next | ( | ) |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 151 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::numRows | ( | ) |
Get the number of rows in a result object.
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 94 of file ResultWrapper.php.
References Wikimedia\Rdbms\ResultWrapper\doNumRows().
Referenced by Wikimedia\Rdbms\QueryStatus\__construct().
Wikimedia\Rdbms\ResultWrapper::rewind | ( | ) |
Definition at line 134 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::seek | ( | $pos | ) |
Change the position of the cursor in a result object.
See mysql_data_seek()
OutOfBoundsException |
int | $pos |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 114 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::valid | ( | ) |
Definition at line 155 of file ResultWrapper.php.
|
protected |
The offset of the current row that would be returned by current() and may have been previously returned by fetchObject().
Definition at line 34 of file ResultWrapper.php.
Referenced by Wikimedia\Rdbms\FakeResultWrapper\doFetchObject(), and Wikimedia\Rdbms\SqliteResultWrapper\doFetchObject().
|
protected |
The row at $this->currentPos, or null if it has not yet been retrieved, or false if the current row was past the end.
Definition at line 40 of file ResultWrapper.php.
|
protected |
The offset of the row that would be returned by the next call to fetchObject().
Definition at line 28 of file ResultWrapper.php.