Re: PDO_DBLIB Native PHP Type binding
| From: | Richard Lynch | Date: | Fri, 05 Nov 2010 00:37:45 +0000 |
| Subject: | Re: PDO_DBLIB Native PHP Type binding | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50102@lists.php.net to get a copy of this message | ||
On Wed, November 3, 2010 8:52 pm, Stanley Sufficool wrote:
> Before I gut PDO_DBLIB one more time to implement native parameter
> binding for stored procedures, what are the thoughts on returning the
> column values from the database as the native PHP type when possible?
> Currently everything is returned as a string, incurring overhead for
> conversion and creating problems hinting at the desired binding type
> for BLOBS and numeric data types.
It *SEEMS* like a Good Idea (tm) until you think it through and
realize that there is NOT a one-to-one correspondence between PHP
native types and DB native types.
Even what seems like a no-brainer for, say, INT is not. Does PHP INT
have the same range as the DB INT? Dollars to doughnuts says "No." is
the correct answer.
BIGINT? Not a chance. PHP doesn't really do bigint, unless you want
to return some GMP thing, which is probably not a Good Idea, as GMP
isn't always there, I don't think.
Then you start looking at things like an enum, or GeoIP, or IP address
as native DB types, and it gets really ugly, really fast.
--
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE