MediaWiki REL1_35
Wikimedia\Rdbms\FakeResultWrapper Class Reference

Overloads the relevant methods of the real ResultsWrapper so it doesn't go anywhere near an actual database. More...

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

Public Member Functions

 __construct ( $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 ()
 

Protected Attributes

int $pos = 0
 
stdClass[] array[] $result
 

Detailed Description

Overloads the relevant methods of the real ResultsWrapper so it doesn't go anywhere near an actual database.

Definition at line 11 of file FakeResultWrapper.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\FakeResultWrapper::__construct (   $result)
Parameters
stdClass[] | array[] | FakeResultWrapper$result

Definition at line 21 of file FakeResultWrapper.php.

References Wikimedia\Rdbms\FakeResultWrapper\$result.

Member Function Documentation

◆ count()

Wikimedia\Rdbms\FakeResultWrapper::count ( )

Get the number of rows in a result object.

Returns
int

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 33 of file FakeResultWrapper.php.

Referenced by Wikimedia\Rdbms\FakeResultWrapper\numRows().

◆ current()

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

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 65 of file FakeResultWrapper.php.

◆ fetchObject()

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

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 37 of file FakeResultWrapper.php.

◆ fetchRow()

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

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 45 of file FakeResultWrapper.php.

◆ free()

Wikimedia\Rdbms\FakeResultWrapper::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 57 of file FakeResultWrapper.php.

◆ key()

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

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 72 of file FakeResultWrapper.php.

◆ next()

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

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 76 of file FakeResultWrapper.php.

◆ numRows()

Wikimedia\Rdbms\FakeResultWrapper::numRows ( )

Get the number of rows in a result object.

Returns
int

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 29 of file FakeResultWrapper.php.

References Wikimedia\Rdbms\FakeResultWrapper\count().

◆ rewind()

Wikimedia\Rdbms\FakeResultWrapper::rewind ( )

Definition at line 61 of file FakeResultWrapper.php.

◆ seek()

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

Change the position of the cursor in a result object.

See mysql_data_seek()

Parameters
int$pos

Implements Wikimedia\Rdbms\IResultWrapper.

Definition at line 53 of file FakeResultWrapper.php.

◆ valid()

Wikimedia\Rdbms\FakeResultWrapper::valid ( )

Definition at line 82 of file FakeResultWrapper.php.

Member Data Documentation

◆ $pos

int Wikimedia\Rdbms\FakeResultWrapper::$pos = 0
protected

Definition at line 16 of file FakeResultWrapper.php.

◆ $result

stdClass [] array [] Wikimedia\Rdbms\FakeResultWrapper::$result
protected

Definition at line 13 of file FakeResultWrapper.php.

Referenced by Wikimedia\Rdbms\FakeResultWrapper\__construct().


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