MediaWiki REL1_35
Wikimedia\Rdbms\IResultWrapper Interface Reference

Result wrapper for grabbing data queried from an IDatabase object. More...

Inheritance diagram for Wikimedia\Rdbms\IResultWrapper:
Collaboration diagram for Wikimedia\Rdbms\IResultWrapper:

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.
 
 key ()
 
 next ()
 
 numRows ()
 Get the number of rows in a result object.
 
 seek ( $pos)
 Change the position of the cursor in a result object.
 

Detailed Description

Result wrapper for grabbing data queried from an IDatabase object.

Note that using the Iterator methods in combination with the non-Iterator DB 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. If no database is provided, and the subclass does not override the DB iteration methods, then a RuntimeException will be thrown when iteration is attempted.

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.

Definition at line 24 of file IResultWrapper.php.

Member Function Documentation

◆ count()

Wikimedia\Rdbms\IResultWrapper::count ( )

Get the number of rows in a result object.

Returns
int

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ current()

Wikimedia\Rdbms\IResultWrapper::current ( )
Returns
stdClass|array|bool

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ fetchObject()

Wikimedia\Rdbms\IResultWrapper::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.

Returns
stdClass|bool
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ fetchRow()

Wikimedia\Rdbms\IResultWrapper::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.

Returns
array|bool
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ free()

Wikimedia\Rdbms\IResultWrapper::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.

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ key()

Wikimedia\Rdbms\IResultWrapper::key ( )

◆ next()

Wikimedia\Rdbms\IResultWrapper::next ( )
Returns
stdClass PhanParamSignatureMismatchInternal

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ numRows()

Wikimedia\Rdbms\IResultWrapper::numRows ( )

Get the number of rows in a result object.

Returns
int

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.

◆ seek()

Wikimedia\Rdbms\IResultWrapper::seek (   $pos)

Change the position of the cursor in a result object.

See mysql_data_seek()

Parameters
int$pos

Implemented in Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\ResultWrapper.


The documentation for this interface was generated from the following file: