On Thu, Nov 4, 2010 at 5:37 PM, Richard Lynch <c...@l-i-e.com> wrote: > 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.
I realize that non Zend types would have to be returned as a string representation. The hangups I am having is with large objects returned as streams in some drivers (but not dblib) and inconsistent date/time string representations across drivers depending on server configuration files (freetds.conf). Another BIG issue I am having when using strings with DBLIB is that they go through iconv, destroying binary values when translated to the server character set from the assumed latin1 PHP client character set. SQL Server for some reason allows characters to be stored in a varchar/text fields even though the character is not defined in the servers code page, whereas iconv pukes with an error. It would be a wonderful development to have an RFC on the preferred string representation of various objects as returned by the driver so that when using ANSI SQL with PDO you can expect the same representation across all drivers. > > -- > 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 > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php