MediaWiki REL1_35
|
Result wrapper for grabbing data queried from an IDatabase object. More...
Public Member Functions | |
__construct (IDatabase $db, $result) | |
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. | |
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 () | |
Static Public Member Functions | |
static & | unwrap (&$res) |
Get the underlying RDBMS driver-specific result resource. | |
Protected Attributes | |
stdClass bool null | $currentRow |
IDatabase | $db |
int | $pos = 0 |
mixed null | $result |
RDBMS driver-specific result resource. | |
Private Member Functions | |
getDB () | |
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::__construct | ( | IDatabase | $db, |
$result | |||
) |
IDatabase | $db | Database handle that the result comes from |
self | mixed | $result | RDBMS driver-specific result resource |
Definition at line 38 of file ResultWrapper.php.
References Wikimedia\Rdbms\ResultWrapper\$db, and Wikimedia\Rdbms\ResultWrapper\$result.
Wikimedia\Rdbms\ResultWrapper::count | ( | ) |
Get the number of rows in a result object.
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 75 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::current | ( | ) |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 107 of file ResultWrapper.php.
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 79 of file ResultWrapper.php.
References getDB().
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 83 of file ResultWrapper.php.
References getDB().
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 92 of file ResultWrapper.php.
|
private |
RuntimeException |
Definition at line 135 of file ResultWrapper.php.
Referenced by Wikimedia\Rdbms\ResultWrapper\numRows().
Wikimedia\Rdbms\ResultWrapper::key | ( | ) |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 115 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::next | ( | ) |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 119 of file ResultWrapper.php.
Wikimedia\Rdbms\ResultWrapper::numRows | ( | ) |
Get the number of rows in a result object.
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 71 of file ResultWrapper.php.
References Wikimedia\Rdbms\ResultWrapper\getDB().
Wikimedia\Rdbms\ResultWrapper::rewind | ( | ) |
Definition at line 98 of file ResultWrapper.php.
References getDB().
Wikimedia\Rdbms\ResultWrapper::seek | ( | $pos | ) |
Change the position of the cursor in a result object.
See mysql_data_seek()
int | $pos |
Implements Wikimedia\Rdbms\IResultWrapper.
Definition at line 87 of file ResultWrapper.php.
|
static |
Get the underlying RDBMS driver-specific result resource.
The result resource field should not be accessed from non-Database related classes. It is database class specific and is stored here to associate iterators with queries.
self | mixed | &$res |
Definition at line 59 of file ResultWrapper.php.
References $res.
Referenced by Wikimedia\Rdbms\DatabaseMysqlBase\dataSeek(), Wikimedia\Rdbms\DatabasePostgres\dataSeek(), Wikimedia\Rdbms\DatabaseSqlite\dataSeek(), Wikimedia\Rdbms\DatabaseSqlite\doQuery(), Wikimedia\Rdbms\DatabaseMysqlBase\fetchObject(), Wikimedia\Rdbms\DatabasePostgres\fetchObject(), Wikimedia\Rdbms\DatabaseSqlite\fetchObject(), Wikimedia\Rdbms\DatabaseMysqlBase\fetchRow(), Wikimedia\Rdbms\DatabasePostgres\fetchRow(), Wikimedia\Rdbms\DatabaseSqlite\fetchRow(), Wikimedia\Rdbms\DatabaseMysqlBase\fieldInfo(), Wikimedia\Rdbms\DatabaseMysqlBase\fieldName(), Wikimedia\Rdbms\DatabasePostgres\fieldName(), Wikimedia\Rdbms\DatabaseSqlite\fieldName(), Wikimedia\Rdbms\DatabasePostgres\fieldType(), Wikimedia\Rdbms\DatabaseMysqlBase\fieldType(), Wikimedia\Rdbms\DatabaseMysqlBase\freeResult(), Wikimedia\Rdbms\DatabasePostgres\freeResult(), Wikimedia\Rdbms\DatabaseMysqlBase\numFields(), Wikimedia\Rdbms\DatabasePostgres\numFields(), Wikimedia\Rdbms\DatabaseSqlite\numFields(), Wikimedia\Rdbms\DatabaseMysqlBase\numRows(), Wikimedia\Rdbms\DatabasePostgres\numRows(), and Wikimedia\Rdbms\DatabaseSqlite\numRows().
Wikimedia\Rdbms\ResultWrapper::valid | ( | ) |
Definition at line 127 of file ResultWrapper.php.
|
protected |
Definition at line 32 of file ResultWrapper.php.
|
protected |
Definition at line 25 of file ResultWrapper.php.
Referenced by Wikimedia\Rdbms\ResultWrapper\__construct().
|
protected |
Definition at line 30 of file ResultWrapper.php.
|
protected |
RDBMS driver-specific result resource.
Definition at line 27 of file ResultWrapper.php.
Referenced by Wikimedia\Rdbms\ResultWrapper\__construct().