Re: [PDO] PDO_DBLIB Native PHP Type binding

From: Date: Thu, 04 Nov 2010 03:48:56 +0000
Subject: Re: [PDO] PDO_DBLIB Native PHP Type binding
References: 1 2  Groups: php.internals php.pdo 
Request: Send a blank email to internals+get-50099@lists.php.net to get a copy of this message
On Wed, Nov 3, 2010 at 8:25 PM, Wez Furlong <kingwez@gmail.com> wrote: > > On Nov 3, 2010, at 9: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 > > The design philosophy was to pull the data out as strings as this gives the > highest data fidelity (especially with the various numeric types) and is a > pragmatic choice for the majority of web apps which are largely in text land > anyway, and typically are not bottlenecked on the performance of converting > database column values. > > Some drivers, particularly postgres, are unable to request string data and > therefore return their results in the type that most closely matches the C > datatype forced on it by the API. > > This has been a source of complaints from some about the consistency of the > returned data for apps that are designed to run against multiple database > backends. > > I would advise against changing the behavior of the driver if possible, and > against changing it away from the established stringiness of PDO without > good reason. One reason was to bring the driver in line with the behavior of the PDO sqlserv driver ( http://msdn.microsoft.com/en-us/library/cc296193.aspx ) Eventually I would like yo make the 2 interchangeable and have PHP/PDO applications run the same on Win32 and Linux. > >> and creating problems hinting at the desired binding type >> for BLOBS and numeric data types. Yes, you are right. I can bind columns as strings and parameters as a specific data type independently. > > Can you elaborate on this? You can explicitly set the desired binding via > bindColumn. > > --Wez. >

« previous php.internals (#50099) next »