MediaWiki REL1_40
Wikimedia\Rdbms\IResultWrapper Interface Reference

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

Inherits Countable, and SeekableIterator.

Inherited by Wikimedia\Rdbms\ResultWrapper.

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.
 
 getFieldNames ()
 Get the names of the fields in the result.
 
 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 26 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\ResultWrapper.

◆ current()

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

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|false
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implemented in 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|false
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implemented in 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\ResultWrapper.

◆ getFieldNames()

Wikimedia\Rdbms\IResultWrapper::getFieldNames ( )

Get the names of the fields in the result.

Since
1.37
Returns
string[]

Implemented in Wikimedia\Rdbms\ResultWrapper.

◆ key()

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

Implemented in Wikimedia\Rdbms\ResultWrapper.

◆ next()

Wikimedia\Rdbms\IResultWrapper::next ( )
Returns
void

Implemented in Wikimedia\Rdbms\ResultWrapper.

◆ numRows()

Wikimedia\Rdbms\IResultWrapper::numRows ( )

Get the number of rows in a result object.

Returns
int

Implemented in Wikimedia\Rdbms\ResultWrapper.

◆ seek()

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

Change the position of the cursor in a result object.

See mysql_data_seek()

Exceptions
OutOfBoundsException
Parameters
int$pos

Implemented in Wikimedia\Rdbms\ResultWrapper.


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