r50614 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50613‎ | r50614 | r50615 >
Date:02:49, 15 May 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Fix breakage of SQLite ResultWrapper due to r45769. The "result" member in SQLite is actually an array and so passing by value to DatabaseSqlite::fetchObject() makes it fail to iterate. We can't really pass it by reference since that's an E_STRICT error due to a parameter type mismatch with Database. Pass the ResultWrapper instead.

This means that nothing at all should be passing bare result objects/arrays to Database*::fetchObject() anymore. The "instanceof ResultWrapper" logic can be removed in a subsequent commit. It can stay in this one for now for safer backport to 1.15.
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -2764,7 +2764,7 @@
27652765 * Get the number of rows in a result object
27662766 */
27672767 function numRows() {
2768 - return $this->db->numRows( $this->result );
 2768+ return $this->db->numRows( $this );
27692769 }
27702770
27712771 /**
@@ -2777,7 +2777,7 @@
27782778 * @throws DBUnexpectedError Thrown if the database returns an error
27792779 */
27802780 function fetchObject() {
2781 - return $this->db->fetchObject( $this->result );
 2781+ return $this->db->fetchObject( $this );
27822782 }
27832783
27842784 /**
@@ -2789,14 +2789,14 @@
27902790 * @throws DBUnexpectedError Thrown if the database returns an error
27912791 */
27922792 function fetchRow() {
2793 - return $this->db->fetchRow( $this->result );
 2793+ return $this->db->fetchRow( $this );
27942794 }
27952795
27962796 /**
27972797 * Free a result object
27982798 */
27992799 function free() {
2800 - $this->db->freeResult( $this->result );
 2800+ $this->db->freeResult( $this );
28012801 unset( $this->result );
28022802 unset( $this->db );
28032803 }
@@ -2806,7 +2806,7 @@
28072807 * See mysql_data_seek()
28082808 */
28092809 function seek( $row ) {
2810 - $this->db->dataSeek( $this->result, $row );
 2810+ $this->db->dataSeek( $this, $row );
28112811 }
28122812
28132813 /*********************
@@ -2817,7 +2817,7 @@
28182818
28192819 function rewind() {
28202820 if ($this->numRows()) {
2821 - $this->db->dataSeek($this->result, 0);
 2821+ $this->db->dataSeek($this, 0);
28222822 }
28232823 $this->pos = 0;
28242824 $this->currentRow = null;

Follow-up revisions

RevisionCommit summaryAuthorDate
r50616* Backported r50614: SQLite ResultWrapper fix. Noted SQLite reintroduction in...tstarling03:11, 15 May 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45769* Preserve usertext_timestamp index name for MySQL, prefix it for SQLite. Iss...tstarling14:20, 15 January 2009

Status & tagging log