Mapping data type/size
[email protected] (Lester Caine) Wed, 28 Oct 2009 17:15:37 +0000
| Newsgroups | php.pdo |
|---|---|
| Message-ID | <[email protected]> |
Please bare with me ... I'm still trying to 'convert' from my normal way of working ;) PDO::PARAM_INT is available, but no other numeric formats? I've been working through all the options to map data types into the correct internal format, but I'm not having much luck. Numeric types would be better passed as numbers rather than strings, but the main problem I'm hitting here is how to know which field types from one database map to another. Such as 'BOOL' which is normally handled as a CHAR(1) in Firebird, and also the different numeric field sizes of FLOAT and the like. The bottom line is that we have to know the structure of the table before we can use it? We can't simply ask for those details from the database and adjust things acordingly? Should it be possible to force LOB fields to be connected as PDO::PARAM_STR? I'm not sure that this actually solves the problem since there is needs to be some information available to tell you which fields are LOB but need mapping to simple strings? However 'insert' should just load a string into the bound field? So it's just query that needs to return a string later? With Firebird we simply switch the driver to IBASE_TEXT mode and it returns strings. Should I be looking to add that to the pdo_firebird driver as an optional setting. Really until I can get this bit working I can't get much further using my current projects. I regularly use date/time internally in Firebird as the numeric values that they are handled as but this is another area that is getting lost in the translation between PDO and the database. Although this may just be a matter of getting the right format of string conversion - I've had great fun with US/UK day/month ordering over the years :( -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php