MediaWiki  1.30.2
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

 current ()
 
 fetchObject ()
 Fetch the next row from the given result object, in object form. More...
 
 fetchRow ()
 Fetch the next row from the given result object, in associative array form. More...
 
 free ()
 Free a result object. More...
 
 key ()
 
 next ()
 
 numRows ()
 Get the number of rows in a result object. More...
 
 seek ( $row)
 Change the position of the cursor in a result object. More...
 

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

◆ current()

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

Implemented in 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\ResultWrapper, Wikimedia\Rdbms\FakeResultWrapper, and Wikimedia\Rdbms\MssqlResultWrapper.

◆ 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\ResultWrapper, Wikimedia\Rdbms\MssqlResultWrapper, and Wikimedia\Rdbms\FakeResultWrapper.

◆ 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\ResultWrapper, and Wikimedia\Rdbms\FakeResultWrapper.

◆ key()

Wikimedia\Rdbms\IResultWrapper::key ( )
Returns
int

Implemented in Wikimedia\Rdbms\ResultWrapper.

◆ next()

Wikimedia\Rdbms\IResultWrapper::next ( )

◆ numRows()

Wikimedia\Rdbms\IResultWrapper::numRows ( )

Get the number of rows in a result object.

Returns
int

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

◆ seek()

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

Change the position of the cursor in a result object.

See mysql_data_seek()

Parameters
int$row

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


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