MediaWiki  1.27.2
ResultWrapper Class Reference

Result wrapper for grabbing data queried by someone else. More...

Inheritance diagram for ResultWrapper:
Collaboration diagram for ResultWrapper:

Public Member Functions

 __construct ($database, $result)
 Create a new result object from a result resource and a Database object. More...
 
 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...
 
 rewind ()
 
 seek ($row)
 Change the position of the cursor in a result object. More...
 
 valid ()
 

Public Attributes

resource $result
 

Protected Attributes

object null $currentRow = null
 
DatabaseBase $db
 
int $pos = 0
 

Detailed Description

Result wrapper for grabbing data queried by someone else.

Definition at line 77 of file DatabaseUtility.php.

Constructor & Destructor Documentation

ResultWrapper::__construct (   $database,
  $result 
)

Create a new result object from a result resource and a Database object.

Parameters
DatabaseBase$database
resource | ResultWrapper$result

Definition at line 96 of file DatabaseUtility.php.

References $result.

Member Function Documentation

ResultWrapper::current ( )
Returns
stdClass|array|bool

Definition at line 174 of file DatabaseUtility.php.

References $currentRow, and next().

Referenced by valid().

ResultWrapper::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

Definition at line 123 of file DatabaseUtility.php.

Referenced by IndexPager\extractResultInfo(), and next().

ResultWrapper::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

Definition at line 134 of file DatabaseUtility.php.

Referenced by IndexPager\extractResultInfo().

ResultWrapper::free ( )

Free a result object.

Definition at line 141 of file DatabaseUtility.php.

ResultWrapper::key ( )
Returns
int

Definition at line 185 of file DatabaseUtility.php.

References $pos.

ResultWrapper::next ( )
Returns
stdClass

Definition at line 192 of file DatabaseUtility.php.

References $currentRow, and fetchObject().

Referenced by current().

ResultWrapper::numRows ( )

Get the number of rows in a result object.

Returns
int

Definition at line 111 of file DatabaseUtility.php.

Referenced by IndexPager\extractResultInfo(), and rewind().

ResultWrapper::rewind ( )

Definition at line 163 of file DatabaseUtility.php.

References numRows().

ResultWrapper::seek (   $row)

Change the position of the cursor in a result object.

See mysql_data_seek()

Parameters
int$row

Definition at line 153 of file DatabaseUtility.php.

Referenced by IndexPager\extractResultInfo().

ResultWrapper::valid ( )
Returns
bool

Definition at line 202 of file DatabaseUtility.php.

References current().

Member Data Documentation

object null ResultWrapper::$currentRow = null
protected

Definition at line 88 of file DatabaseUtility.php.

Referenced by current(), and next().

DatabaseBase ResultWrapper::$db
protected

Definition at line 82 of file DatabaseUtility.php.

int ResultWrapper::$pos = 0
protected

Definition at line 85 of file DatabaseUtility.php.

Referenced by key().

resource ResultWrapper::$result

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