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

Bug #11652 Perparing queries that contain the :: style of casing is broken.
Submitted: 2007-07-20 12:38 UTC
From: crowly Assigned: quipo
Status: Closed Package: MDB2 (version 2.4.1)
PHP Version: 5.2.2 OS: Linux
Roadmaps: (Not assigned)    

 [2007-07-20 12:38 UTC] crowly (John Brown)
Description: ------------ Postgresql allows type conversion of the form select id::varchar(20) from sometable; However is this style of casting is used the prepared statement parser treats ::varchar as a named placeholder sending an invalid query to the db. While this can be worked around by rewriting the query in the form cast(id as varchar(20). It should not match ::int as a named place holder. Test script: --------------- $db=mdb2::factory($aYourSettings); $sQuery="select id::varchar(20) from sometable where name=?"; $oPrep=$db->prepare($sQuery); $oRes=$oPrep->execute(array('fred')); if (PEAR::isError($oRes)) { die($oRes->getMessage()); } Expected result: ---------------- Should on die with unable to prepare statment. The string sent the db should be PERPARE mdb2-statement-id AS select id::varchar(20) from sometable where name=$1; Actual result: -------------- PERPARE mdb2-statement-id AS select id$1


 [2007-07-20 22:41 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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.