PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #5611

limitQuery doesn't work with $limit = -1

Details

Submitted2005-10-05 19:27 UTC
Fromvaclav dot sir at gmail dot com
StatusWont fix
PackageDB
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2005-10-05 19:27 UTC] vaclav dot sir at gmail dot com

Description:
------------
It isn't able to use limitQuery($query, 123, -1) to retrieve all rows from a certain offset up to the end of the result set. The problem is one condition in fetchRow - file DB.php, line 1103
If I try to select something from an offset to the end, fetchRow always returns NULL.

Another aspect is that some DBs don't know LIMIT -1 (e.g. MySQL 4.1.x). It should be simulated in those databases.

Test script:
---------------
// this could be the replacement of the line 1103 in DB.php
if (($this->limit_count != -1)
&& $this->row_counter >=($this->limit_from + $this->limit_count))

// Something similar to this should be placed
// in drivers of databases not understanding LIMIT -1
if ($limit == -1) {
$limit = very big number;
}