Page MenuHomePhabricator

wrong result for numFileds in sqlite
Closed, ResolvedPublic


Author: physik

Sqllite uses the size of the result array to count the number of rows.

		$r = $res instanceof ResultWrapper ? $res->result : $res;
		return is_array( $r ) ? count( $r[0] ) : 0;

but the size of the result array is the double of the expected result since it contains an array with the row_names->values and row numbers->values

Version: 1.24rc
Severity: major



Related Objects


Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:10 AM
bzimport set Reference to bz65578.
bzimport added a subscriber: Unknown Object (MLST).

Change 134591 had a related patch set uploaded by Physikerwelt:
WIP: Fix: numFields wrong for sqlite

physik wrote:

There are actually two bugs.

  1. if the relation is empty a runtime error occours
  2. the number of fields is calculated the wrong way

the patch corrects the calculation if the result is not empty.
I was not capable to return the correct number of fields for empty relations. This would require a major rewrite to be capable of using the schema information from the PDO result set. For such a change I'd need to install sqlite locally in vagrant...

physik wrote:

I'm done with working on that and waiting for code review

Change 134591 merged by jenkins-bot:
Fix: numFields wrong for sqlite