dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "always order by page_id for dumps of current revisions"
[lhc/web/wiklou.git]
/
includes
/
libs
/
rdbms
/
database
/
resultwrapper
/
ResultWrapper.php
diff --git
a/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php
b/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php
index
1355e22
..
b7938ad
100644
(file)
--- a/
includes/libs/rdbms/database/resultwrapper/ResultWrapper.php
+++ b/
includes/libs/rdbms/database/resultwrapper/ResultWrapper.php
@@
-30,8
+30,8
@@
class ResultWrapper implements IResultWrapper {
/** @var int */
protected $pos = 0;
/** @var int */
protected $pos = 0;
- /** @var stdClass|null */
- protected $currentRow
= null
;
+ /** @var stdClass|
bool|
null */
+ protected $currentRow;
/**
* Create a row iterator from a result resource and an optional Database object
/**
* Create a row iterator from a result resource and an optional Database object
@@
-63,30
+63,16
@@
class ResultWrapper implements IResultWrapper {
return $this->getDB()->fetchRow( $this );
}
return $this->getDB()->fetchRow( $this );
}
- public function seek( $row ) {
- $this->getDB()->dataSeek( $this, $row );
+ public function seek( $pos ) {
+ $this->getDB()->dataSeek( $this, $pos );
+ $this->pos = $pos;
}
public function free() {
}
public function free() {
- if ( $this->db ) {
- $this->db->freeResult( $this );
- $this->db = null;
- }
+ $this->db = null;
$this->result = null;
}
$this->result = null;
}
- /**
- * @return IDatabase
- * @throws RuntimeException
- */
- private function getDB() {
- if ( !$this->db ) {
- throw new RuntimeException( static::class . ' needs a DB handle for iteration.' );
- }
-
- return $this->db;
- }
-
function rewind() {
if ( $this->numRows() ) {
$this->getDB()->dataSeek( $this, 0 );
function rewind() {
if ( $this->numRows() ) {
$this->getDB()->dataSeek( $this, 0 );
@@
-96,8
+82,8
@@
class ResultWrapper implements IResultWrapper {
}
function current() {
}
function current() {
- if (
is_null( $this->currentRow )
) {
- $this->
nex
t();
+ if (
$this->currentRow === null
) {
+ $this->
currentRow = $this->fetchObjec
t();
}
return $this->currentRow;
}
return $this->currentRow;
@@
-117,6
+103,18
@@
class ResultWrapper implements IResultWrapper {
function valid() {
return $this->current() !== false;
}
function valid() {
return $this->current() !== false;
}
+
+ /**
+ * @return IDatabase
+ * @throws RuntimeException
+ */
+ private function getDB() {
+ if ( !$this->db ) {
+ throw new RuntimeException( static::class . ' needs a DB handle for iteration.' );
+ }
+
+ return $this->db;
+ }
}
/**
}
/**