Last modified: 2010-05-15 15:59:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T13706, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11706 - ResultWrapper inconsistency regarding rows
ResultWrapper inconsistency regarding rows
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.11.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-19 09:46 UTC by Karsten Hiddemann
Modified: 2010-05-15 15:59 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Karsten Hiddemann 2007-10-19 09:46:54 UTC
Hi, if I do the following I am receiving lots of results:

$t = Title::newFromText("Main_Page"); 
$dbr = wfGetDB(DB_SLAVE);
while ($row = $dbr->fetchObject(Revision::fetchRevision($t))) {
  var_dump($row);
}

However, doing the following I am only receving a single result:

$t = Title::newFromText("Main_Page");
$r = Revision::fetchRevision($t);
$dbr = wfGetDB(DB_SLAVE);
while ($row = $dbr->fetchObject($r)) {
  var_dump($row);
}

The same here:

$dbr = wfGetDB(DB_SLAVE);
$t = Title::newFromText("Main_Page");
$r = ResultWrapper ($dbr, Revision::fetchRevision($t));
while ($row = $dbr->fetchObject($r)) {
  var_dump($row);
}

And to top it, if I change the code at top to the following, I receive the output "1", too:

$t = Title::newFromText("Main_Page"); 
print Revision::fetchRevision($t)->numRows();

Can somebody explain why it is this inconsistent? Is there something I'm doing wrong?
Comment 1 Karsten Hiddemann 2007-10-19 09:49:25 UTC
Third example should read

$r = new ResultWrapper ($dbr, Revision::fetchRevision($t));

of course.
Comment 2 Karsten Hiddemann 2007-10-21 22:50:19 UTC
Scrap that, as brion pointed out the first example does a new query for the revisions on every loop, that's why it never finishes... :P

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links