PEAR is archived and read-only

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

Home » Database » MDB2 » Bug #9502

Strong typing query result misbehaves

Details

Submitted2006-11-29 19:08 UTC
Frombenblay at gmail dot com
Assigneddanielc
StatusClosed
PackageMDB2
PHP Version5.1.2
OSLinux 2.6.15-23
Roadmaps2.5.0b4

Comments

[2006-11-29 19:08 UTC] benblay at gmail dot com

Description:
------------
When using the second parameter of queryRow() to strong type results, columns not specified behave erratically. That is, some values are not returned at all. If the same method is used without strong typing, the column values are returned as text without a problem.

I've tested this in a variety of ways and it seems that the number of fields that are strong typed are applied to the field set represented by * no matter what.

Test script:
---------------
Example 1:

$insInfo = $db->queryRow('SELECT * FROM "thisTable" WHERE "thisTableid" = '.$rec, array('SectionOneInclude' => 'boolean', 'SectionTwoInclude' => 'boolean'));

Example 2:

$insInfo = $db->queryRow('SELECT "SectionOneInclude", "SectionTwoInclude", * FROM "thisTable" WHERE "thisTableid" = '.$rec, array('SectionOneInclude' => 'boolean', 'SectionTwoInclude' => 'boolean'));

Expected result:
----------------
In Example 1, I would expect to get the entire result set as normal, with the two values for $insInfo['SectionOneInclude'] and $insInfo['SectionTwoInclude'] strong typed to boolean. While the latter does occur, the strong typing also applies to the first two columns of the entire result set. In other words, if the columns of the table were thisTableid, Name, Address, Phone, SectionOneInclude, and SectionTwoInclude, the result expected result is:
[thisTableid] => 2
[Name] => ABC Widgets
[Address] => 123 Main Street
[Phone] => 555-666-7777
[SectionOneInclude] => 1
[SectionTwoInclude] =>

I'd expect the same result for the second example, except that the SectionOneInclude and SectionTwoInclude fields would be returned at the top of the results.

Actual result:
--------------
[thisTableid] =>
[Name] =>
[Address] => 123 Main Street
[Phone] => 555-666-7777
[SectionOneInclude] => 1
[SectionTwoInclude] =>