Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Doc Bug #19303 Using an indexed type array with assoc or object fetch doesn't set types
Submitted: 2012-02-23 23:35 UTC
From: gauthierm Assigned:
Status: Open Package: MDB2 (version SVN)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2012-02-23 23:35 UTC] gauthierm (Michael Gauthier)
Description: ------------ Using an indexed type array with assoc or object fetch doesn't set types. The returned results are all strings rather than the specified types. Using an associative types array works correctly. The attached patch fixes the issue in SVN trunk

Comments

 [2012-02-23 23:37 UTC] gauthierm (Michael Gauthier)
 [2012-02-24 00:57 UTC] gauthierm (Michael Gauthier)
 [2012-10-25 06:21 UTC] danielc (Daniel Convissor)
-Type: Bug +Type: Documentation Problem
This is by design. The code in the each driver's fetchRow() method and in MDB2_Result_Common::setResultTypes() are explicitly constructed to have enumerated arrays of types go with enumerated arrays of results and have associative arrays of types go with associative and object results. That aside, a modified version of the provided patch doesn't work for me. I added some tests in commit r328136. The unsupported variations are commented out. The documentation could (well, should) be better about explaining this, so I'll convert it to a documentation ticket.
 [2012-10-25 15:19 UTC] gauthierm (Michael Gauthier)
What doesn't work in the patch? In MDB2 2.4.x, enumerated arrays of types worked with assoc and object fetch methods.
 [2012-10-26 01:31 UTC] danielc (Daniel Convissor)
Hi Mike: Ugh. So this is a BC break from 2.4.x. This is definitely needs documentation, particularly in the release notes. While passing an enum array of types worked in some cases in 2.4.x, there are some cases it did not. See bug #9502 and bug #18203. Here's some history of the code in question: Original code in 2.4.x: r234892 http://svn.php.net/viewvc?view=revision&revision=308955 all quippo http://svn.php.net/viewvc?view=revision&revision=321210 mdb2 me http://svn.php.net/viewvc?view=revision&revision=321234 mdb2 me http://svn.php.net/viewvc?view=revision&revision=322953 all gauthierm http://svn.php.net/viewvc?view=revision&revision=328145 drivers me A patch that passes all of the unit tests is always welcome, particularly those in tests/Standard/UsageTest.php tests/Standard/BugsTest.php.
 [2012-11-02 00:27 UTC] gauthierm (Michael Gauthier)
In #9502, an incomplete assoc array of types is being passed. In #18203, no explicit types are passed and introspective typing is used ($types = true). The bug is the enumerated types array built by introspection is not correct. These use cases are not contradictory to passing an explicit enum array of types for a fetch assoc or fetch obj row. Before I work on a patch to add enum type array support back to assoc and obj fetches, can you think of a use case where it will break?
 [2012-11-09 19:34 UTC] danielc (Daniel Convissor)
Hey Mike: Haven't forgotten about this. I have some ideas for more unit tests to demonstrate potential pitfalls. I'll post back here once they're committed. Thanks, --Dan