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

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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