Re: [RFC] PDO Float Type
| From: | Matteo Beccati | Date: | Mon, 10 Apr 2017 07:05:59 +0000 |
| Subject: | Re: [RFC] PDO Float Type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98754@lists.php.net to get a copy of this message | ||
Hi Adam,
On 05/04/2017 17:30, Adam Baratz wrote:
> Hi,
>
> The PDO extension does not have a type to represent floating point values.
> The current recommended practice is to use PDO::PARAM_STR.
>
> I had poked at this topic in an earlier thread:
> https://externals.io/thread/551
>
> There was some hesitation about how complicated this would be to implement.
> After looking through each of the supported drivers, it seems like it would
> actually be a fairly light lift. In some cases, switching PDO::PARAM_STR
> for a new float type constant will save a type cast and have the same
> results.
>
> I wrote up a proposal here:
> https://wiki.php.net/rfc/pdo_float_type
>
> I tried to be as thorough as possible in understanding the impact on each
> supported driver. I'd appreciate any feedback on this concept as well as
> its impact on drivers.
Thanks for that. I generally have very little use for float types on a
database, but I guess their support should have been included from day 1
in PDO.
That said, I think the proposed type is likely to be misused for
NUMERIC/DECIMAL fields, which would be pretty bad. Maybe we should also
add PDO::PARAM_NUMERIC in order to avoid mistakes?
Cheers
--
Matteo Beccati
Development & Consulting - http://www.beccati.com/