MediaWiki master
Wikimedia\Rdbms\FakeResultWrapper Class Reference

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

Inherits Wikimedia\Rdbms\ResultWrapper.

Collaboration diagram for Wikimedia\Rdbms\FakeResultWrapper:

Public Member Functions

 __construct ( $result)
 
- Public Member Functions inherited from Wikimedia\Rdbms\ResultWrapper
 count ()
 Get the number of rows in a result object.
Returns
int

 
 current ()
 
Returns
stdClass|array|false

 
 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

 
 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

 
 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.
 
 getFieldNames ()
 Get the names of the fields in the result.
Since
1.37
Returns
string[]

 
 key ()
 
Returns
int

 
 next ()
 
Returns
void

 
 numRows ()
 Get the number of rows in a result object.
Returns
int

 
 rewind ()
 
 seek ( $pos)
 Change the position of the cursor in a result object.See mysql_data_seek()
Exceptions
OutOfBoundsException
Parameters
int$pos

 
 valid ()
 

Protected Member Functions

 doFetchObject ()
 Get the next row as a stdClass object, or false if iteration has proceeded past the end.The offset within the result set is in $this->currentPos.
Since
1.37
Returns
stdClass|bool

 
 doFetchRow ()
 Get the next row as an array containing the data duplicated, once with string keys and once with numeric keys, per the PDO::FETCH_BOTH convention.Or false if iteration has proceeded past the end.
Returns
array|bool

 
 doFree ()
 Free underlying data.It is not necessary to do anything.
 
 doGetFieldNames ()
 Get the field names in the result set.
Returns
string[]

 
 doNumRows ()
 Get the number of rows in the result set.
Since
1.37
Returns
int

 
 doSeek ( $pos)
 Modify the current cursor position to the row with the specified offset.If $pos is out of bounds, the behaviour is undefined.
Parameters
int$pos

 

Protected Attributes

stdClass[] array[] null $result
 
- Protected Attributes inherited from Wikimedia\Rdbms\ResultWrapper
int $currentPos = 0
 The offset of the current row that would be returned by current() and may have been previously returned by fetchObject().
 
stdClass array bool null $currentRow
 The row at $this->currentPos, or null if it has not yet been retrieved, or false if the current row was past the end.
 
int $nextPos = 0
 The offset of the row that would be returned by the next call to fetchObject().
 

Detailed Description

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

Definition at line 12 of file FakeResultWrapper.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 19 of file FakeResultWrapper.php.

References Wikimedia\Rdbms\FakeResultWrapper\$result.

Member Function Documentation

◆ doFetchObject()

Wikimedia\Rdbms\FakeResultWrapper::doFetchObject ( )
protected

Get the next row as a stdClass object, or false if iteration has proceeded past the end.The offset within the result set is in $this->currentPos.

Since
1.37
Returns
stdClass|bool

Reimplemented from Wikimedia\Rdbms\ResultWrapper.

Definition at line 33 of file FakeResultWrapper.php.

References Wikimedia\Rdbms\ResultWrapper\$currentPos.

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

◆ doFetchRow()

Wikimedia\Rdbms\FakeResultWrapper::doFetchRow ( )
protected

Get the next row as an array containing the data duplicated, once with string keys and once with numeric keys, per the PDO::FETCH_BOTH convention.Or false if iteration has proceeded past the end.

Returns
array|bool

Reimplemented from Wikimedia\Rdbms\ResultWrapper.

Definition at line 39 of file FakeResultWrapper.php.

References Wikimedia\Rdbms\FakeResultWrapper\doFetchObject().

◆ doFree()

Wikimedia\Rdbms\FakeResultWrapper::doFree ( )
protected

Free underlying data.It is not necessary to do anything.

Reimplemented from Wikimedia\Rdbms\ResultWrapper.

Definition at line 49 of file FakeResultWrapper.php.

◆ doGetFieldNames()

Wikimedia\Rdbms\FakeResultWrapper::doGetFieldNames ( )
protected

Get the field names in the result set.

Returns
string[]

Reimplemented from Wikimedia\Rdbms\ResultWrapper.

Definition at line 54 of file FakeResultWrapper.php.

◆ doNumRows()

Wikimedia\Rdbms\FakeResultWrapper::doNumRows ( )
protected

Get the number of rows in the result set.

Since
1.37
Returns
int

Reimplemented from Wikimedia\Rdbms\ResultWrapper.

Definition at line 28 of file FakeResultWrapper.php.

References Wikimedia\Rdbms\ResultWrapper\count().

◆ doSeek()

Wikimedia\Rdbms\FakeResultWrapper::doSeek ( $pos)
protected

Modify the current cursor position to the row with the specified offset.If $pos is out of bounds, the behaviour is undefined.

Parameters
int$pos

Reimplemented from Wikimedia\Rdbms\ResultWrapper.

Definition at line 45 of file FakeResultWrapper.php.

Member Data Documentation

◆ $result

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

Definition at line 14 of file FakeResultWrapper.php.

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


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