Home » Database » DB » Bug #811
Change to DB 1.6.0 Breaks Informix BC
Details
| Submitted | 2004-02-20 14:47 UTC |
|---|---|
| From | jkaufman at wamnetgov dot com |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 4.3.4 |
| OS | Linux, Mandrake 9.1 |
| Roadmaps | (Not assigned) |
Comments
[2004-02-20 14:47 UTC] jkaufman at wamnetgov dot com
Description:
------------
fetchRow for Informix starts at 1, rather than the expected 0. Code has been written that anticpates this behaviour, and adjusts for it. The latest version of DB (1.6.0) corrects for this behaviour and breaks backward compatibility with existing programs.
Reproduce code:
---------------
/* MySQL fetches rows beginning from 0, Informix starts at 1 */
if ($dbengine=='ifx') { $iRowOffset++; }
if ($iRowTotal) {
$res = $dbh->limitQuery($sql, $iRowOffset, $iRowLimit);
}
$row = $res->fetchRow(DB_FETCHMODE_ASSOC, $iRowOffset);
Expected result:
----------------
Without the adjustment to the row offset, then the first two rows that are retrieved are the same. With the adjustment, the correct rows are returned.
[2004-02-20 15:11 UTC] jkaufman at wamnetgov dot com
My scripts currently compensate for the older behaviour
and will break if I update to the latest DB. I can change
my scripts, but I would have a different problem if the
script ran on an older version of DB.
Since I can't always control the DB version on all
production systems, I need a way to determine the version
and handle it that way (preferred), OR have an option to
maintain backward compatibility as Lukas suggested.