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

Request #7797 support for nonstandard types in prepare()
Submitted: 2006-06-02 15:53 UTC
From: aninias at gmail dot com Assigned: lsmith
Status: Closed Package: MDB2 (version 2.0.3)
PHP Version: 4.3.11 OS: Linux
Roadmaps: (Not assigned)    

 [2006-06-02 15:53 UTC] aninias at gmail dot com (Taylor Swartz)
Description: ------------ Please add support for non-standard datatypes in prepare().


 [2006-06-02 17:49 UTC] davidc (David Coallier)
Could you please give us more informations about what you want really ? For instance, the non-standard datatypes, provide urls, etc. We are all very busy these days, but with your help we can implement it quickly.
 [2006-06-02 23:15 UTC] lsmith (Lukas Smith)
I was talking to him on IRC. The issue is that since MDB2 uses the prepared statement API in pgsql that, if you have a column of for example macaddr, that you need to specify that type in your prepare call. Currently MDB2 only supports the a fairly limited set of types. There needs to be a way to easily define abstract datatypes like these.
 [2006-06-05 07:32 UTC] lsmith (Lukas Smith)
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. I have added a new option called 'datatype_map' into CVS. In this option you can define an array with keys corresponsing to the name of the nonstandard datatype and key what MDB2 native datatype it maps to. so in your case: $mdb2->setOption('datatype_map', array('macaddr' => 'text')); This mapping will be used for all internal quoting, but it will use the name of the nonstandard datatype in the PREPARE call. I have not tested this, but it should work in most cases (atleast those where you can simply map to a native datatype).
 [2006-06-11 14:08 UTC] lsmith (Lukas Smith)
I just added code to CVS that will use pg_prepare() which means that you will no longer have to do any "datatype_map" action at all anymore if you are on PHP5.