Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98873 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27035 invoked from network); 25 Apr 2017 10:07:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2017 10:07:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@beccati.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php@beccati.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain beccati.com designates 176.9.123.236 as permitted sender) X-PHP-List-Original-Sender: php@beccati.com X-Host-Fingerprint: 176.9.123.236 box.beccati.com Received: from [176.9.123.236] ([176.9.123.236:56057] helo=box.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/C8-36901-7CF1FF85 for ; Tue, 25 Apr 2017 06:07:04 -0400 Received: from authenticated-user (box.beccati.com [176.9.123.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by box.beccati.com (Postfix) with ESMTPSA id BE12B2002DB; Tue, 25 Apr 2017 12:06:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1493114819; bh=qk3bd+c02TkhH11WE0upKedPCbiO+5hD2TxYztqJZoE=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=Q/AUYVwRmmAZcwiWX0RBF0bzpWcjEE4C0Puy9yOtQx/k3gfdyYtpWiJDgo9e53v24 +Xe3tWAVyfaDqvZS9jxElhUCliU2D/kyW3JBWGqPsUB9Vrfe5XpxQQ7gcYVRRsuKv4 rGAqJyyKSPFv01a/zi9yQiokGCqeuW9kcpNUKuzqMBFn1aK+X8cFJ7GUjOgNhRsPcI TyVh17KEiWU/hlOa1xEzi6amsgO24afyt+MZgZHaJ4QSS2y5IA9YVruWZ/0YgGtbZx jKgHqjpzjZccgGVOOM6s8iP5fENA84p1D3fG7WVWxfK9JXXJqE2H3GHzK8Pln2rP+s hAptVr27pY58Q== To: Adam Baratz References: <5e3e3e9b-f5b9-a19e-c4cb-6af0f5985d94@beccati.com> <8923084a-a357-91e9-44b5-52a4af0a5df1@beccati.com> <86e4681f-9030-80fc-896b-56255c4b84c7@beccati.com> <36b72547-db1d-125b-62e4-bb3290972dbd@beccati.com> Cc: "internals@lists.php.net" Message-ID: <5b6684df-d8a2-8eea-5908-31beb545a9d1@beccati.com> Date: Tue, 25 Apr 2017 12:06:57 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] PDO Float Type From: php@beccati.com (Matteo Beccati) Hi Adam, On 24/04/2017 19:46, Adam Baratz wrote: > I think we're talking about different things. I'm talking about binding > parameters. It seems like you're talking about fetching column data. You > are correct that fixed-precision values are typically fetched as > strings. One thing to note is that this can be a choice made by the PDO > driver extension. With libpq, PQgetvalue[1] returns all column data as > strings. If you look at pgsql_stmt_get_col, you'll see extra logic to > cast to a zend_bool or zend_long. Other drivers, like pdo_odbc, fetch > everything as a string. Yes, I brought fetching on the table because we should try to be consistent. If numerics are received as strings, they shouldn't be bound as PARAM_FLT, unless the user is willing to potentially lose some information. > I wrote in the RFC how each API works. They all lack this ability, > because they're all limited by the C type system. This is why I was > arguing to merge floats and fixed-precision types. It's a difference > that doesn't exist when sending data to the database. I'll admit I > wasn't paying a lot of attention to retrieving data. There's a lot of > variability between PDO drivers and I didn't want to complicate the > scope of the RFC. Again, there's no limit coming from the C type system: no one is forcing you to cast fixed precision to floating point. In fact it is the opposite: they are normally sent as strings and optionally using the internal (non-float) representation. > If I can summarize our underlying arguments, mine is that PDO parameters > should correspond to zval types and C types, yours is that PDO > parameters should correspond to database column types. A lot of PDO > internals tend to assume the former, even if the latter is the > conventional wisdom. If anything, the database libraries will be using their SQL types system as a reference, specifying what is the C-type you can use to send or retrieve data. On the other hand you argue that we should bring low-level decisions to PDO users. > Honestly, I'm not very attached to having a single type for floats and > fixed-precision. If this RFC doesn't pass, which it doesn't look like it > will, I would be just as happy to cut fixed-precision values out of it. > Though I don't have a good handle on how many of the people who voted > "no" would change their minds if fixed-precision was simply left out of > scope. I don't know, but I wouldn't as I've already explained a number of times. If anything, what I see is that very few care. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/