Last modified: 2010-05-15 15:59:52 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?
Third example should read $r = new ResultWrapper ($dbr, Revision::fetchRevision($t)); of course.
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