616fed9d135e9ac9c5b337d6db223698e4030282
3 namespace Wikimedia\Rdbms
;
9 * Result wrapper for grabbing data queried from an IDatabase object
11 * Note that using the Iterator methods in combination with the non-Iterator
12 * DB result iteration functions may cause rows to be skipped or repeated.
14 * By default, this will use the iteration methods of the IDatabase handle if provided.
15 * Subclasses can override methods to make it solely work on the result resource instead.
16 * If no database is provided, and the subclass does not override the DB iteration methods,
17 * then a RuntimeException will be thrown when iteration is attempted.
19 * The result resource field should not be accessed from non-Database related classes.
20 * It is database class specific and is stored here to associate iterators with queries.
24 interface IResultWrapper
extends Iterator
{
26 * Get the number of rows in a result object
30 public function numRows();
33 * Fetch the next row from the given result object, in object form. Fields can be retrieved with
34 * $row->fieldname, with fields acting like member variables. If no more rows are available,
37 * @return stdClass|bool
38 * @throws DBUnexpectedError Thrown if the database returns an error
40 public function fetchObject();
43 * Fetch the next row from the given result object, in associative array form. Fields are
44 * retrieved with $row['fieldname']. If no more rows are available, false is returned.
47 * @throws DBUnexpectedError Thrown if the database returns an error
49 public function fetchRow();
52 * Change the position of the cursor in a result object.
53 * See mysql_data_seek()
57 public function seek( $pos );
60 * Free a result object
62 * This either saves memory in PHP (buffered queries) or on the server (unbuffered queries).
63 * In general, queries are not large enough in result sets for this to be worth calling.
65 public function free();
68 * @return stdClass|array|bool
70 public function current();
75 public function key();