3 namespace Wikimedia\Rdbms
;
8 * Overloads the relevant methods of the real ResultsWrapper so it
9 * doesn't go anywhere near an actual database.
11 class FakeResultWrapper
extends ResultWrapper
{
12 /** @var $result stdClass[] */
15 * @param stdClass[] $rows
17 function __construct( array $rows ) {
18 parent
::__construct( null, $rows );
22 return count( $this->result
);
26 if ( $this->pos
< count( $this->result
) ) {
27 $this->currentRow
= $this->result
[$this->pos
];
29 $this->currentRow
= false;
32 if ( is_object( $this->currentRow
) ) {
33 return get_object_vars( $this->currentRow
);
35 return $this->currentRow
;
39 function seek( $row ) {
46 function fetchObject() {
48 if ( $this->currentRow
) {
49 return (object)$this->currentRow
;
57 $this->currentRow
= null;
61 return $this->fetchObject();
65 class_alias( FakeResultWrapper
::class, 'FakeResultWrapper' );