2 class MssqlResultWrapper
extends ResultWrapper
{
3 private $mSeekTo = null;
6 * @return stdClass|bool
8 public function fetchObject() {
11 if ( $this->mSeekTo
!== null ) {
12 $result = sqlsrv_fetch_object( $res, 'stdClass', [],
13 SQLSRV_SCROLL_ABSOLUTE
, $this->mSeekTo
);
14 $this->mSeekTo
= null;
16 $result = sqlsrv_fetch_object( $res );
19 // MediaWiki expects us to return boolean false when there are no more rows instead of null
20 if ( $result === null ) {
30 public function fetchRow() {
33 if ( $this->mSeekTo
!== null ) {
34 $result = sqlsrv_fetch_array( $res, SQLSRV_FETCH_BOTH
,
35 SQLSRV_SCROLL_ABSOLUTE
, $this->mSeekTo
);
36 $this->mSeekTo
= null;
38 $result = sqlsrv_fetch_array( $res );
41 // MediaWiki expects us to return boolean false when there are no more rows instead of null
42 if ( $result === null ) {
53 public function seek( $row ) {
57 $numRows = $this->db
->numRows( $res );
58 $row = intval( $row );
60 if ( $numRows === 0 ) {
62 } elseif ( $row < 0 ||
$row > $numRows - 1 ) {
66 // Unlike MySQL, the seek actually happens on the next access
67 $this->mSeekTo
= $row;