FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=9502&edit=1

ID: 9502
Updated by: danielc@analysisandsolutions.com
Reported By: benblay at gmail dot com
Summary: Strong typing query result misbehaves
Status: Closed
Type: Bug
Package: MDB2
Operating System: Linux 2.6.15-23
Package Version: 2.3.0
PHP Version: 5.1.2
-Assigned To: quipo
+Assigned To: danielc
Roadmap Versions:
New Comment:

-Assigned To: quipo
+Assigned To: danielc
Additional changes were necessary to get this working. See revisions
321234 and 321210. They'll be in the next release (which will either be
2.5.0b4 or 2.5.0RC1). This is related to bug #18203.


Previous Comments:
------------------------------------------------------------------------

[2006-12-01 07:30:40] quipo

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

------------------------------------------------------------------------

[2006-11-29 14:08:06] 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] =>

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 19, '11 at 7:36p
activeDec 19, '11 at 7:36p
posts1
users1
websitepear.php.net

1 user in discussion

Danielc: 1 post

People

Translate

site design / logo © 2022 Grokbase