2 class MssqlResultWrapper
extends ResultWrapper
{
3 /** @var integer|null */
4 private $mSeekTo = null;
7 * @return stdClass|bool
9 public function fetchObject() {
12 if ( $this->mSeekTo
!== null ) {
13 $result = sqlsrv_fetch_object( $res, 'stdClass', [],
14 SQLSRV_SCROLL_ABSOLUTE
, $this->mSeekTo
);
15 $this->mSeekTo
= null;
17 $result = sqlsrv_fetch_object( $res );
20 // Return boolean false when there are no more rows instead of null
21 if ( $result === null ) {
31 public function fetchRow() {
34 if ( $this->mSeekTo
!== null ) {
35 $result = sqlsrv_fetch_array( $res, SQLSRV_FETCH_BOTH
,
36 SQLSRV_SCROLL_ABSOLUTE
, $this->mSeekTo
);
37 $this->mSeekTo
= null;
39 $result = sqlsrv_fetch_array( $res );
42 // Return boolean false when there are no more rows instead of null
43 if ( $result === null ) {
54 public function seek( $row ) {
58 $numRows = $this->db
->numRows( $res );
59 $row = intval( $row );
61 if ( $numRows === 0 ) {
63 } elseif ( $row < 0 ||
$row > $numRows - 1 ) {
67 // Unlike MySQL, the seek actually happens on the next access
68 $this->mSeekTo
= $row;