Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97341 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94539 invoked from network); 8 Dec 2016 14:53:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2016 14:53:16 -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:59895] helo=box.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/23-12501-AD379485 for ; Thu, 08 Dec 2016 09:53:15 -0500 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 0A11C200220; Thu, 8 Dec 2016 15:53:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1481208791; bh=IZ7dsytkJqlUAcUVADembXPCd/JyTwTEehD71dGQ8RA=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=DHFXI+hwdWm5916B0zzPUbhiZhlWwD+JJc11AYxqrsnZmigUTjg5DTCucZIDRA0cb eiDNO/A4WNlTX2aQfpUA10xMwVk39X46vPoN/c0iCoHJVUu68eJh9kSjXgeSfT54nM 6AX+6/kKqV1Ss5vQvAIwuADS5o0Glr6LgYLJsLY343iANE1qT160m0d1Xg2sIXP5K7 qxV+giQyxLfK78rKFoCp3lZsYE00IphzKwQa7PjBWNnotP80KqfCFJerrpO9TjIFX9 s5GXXWqAlez378QkQEeQI6uAuM9EKjgi6GUxZToVhIK9dQlqt8B0CDXJd03dagI2sb u/A8qB+zgnq5A== To: Adam Baratz References: Cc: "internals@lists.php.net" Message-ID: Date: Thu, 8 Dec 2016 15:53:08 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PDO::PARAM_DOUBLE From: php@beccati.com (Matteo Beccati) Hi Adam, On 07/12/2016 23:37, Adam Baratz wrote: > For decimal, double wouldn't be the correct type anyway, as it could > cause loss of precision. > > > Sure, agree the name is imprecise. "Double" is mainly relevant to zvals. It's not about naming. Double is relevant both to PHP and SQL and is a floating point type. On the other hand, decimal/numeric fields should be represented as strings as they are fixed point/precision, which is something we don't have in stock php. In fact bcmath uses strings too. > > Is there a reason PDO::PARAM_DOUBLE doesn't exist? > > I don't know if there's am historical reason. I think it should be > there, but to be honest, I'm not sure it's worth the effort at this > point. > > > Say more on why you don't think there'd be a payoff? I'd think that it > would be worth taking the (I'm guessing) max. 3 days involved to add > missing functionality to a widely-used extension. I think it would be the biggest PDO API change to date and we should be very careful. Lots of #ifdefs for pecl pdo_* developers to add, if they want to keep their extensions backwards compatible. My biggest worry is its potential misuse for decimal fields. I know this isn't reason enough for denying an improvement, but there are already too many people mistakenly using double for currency data and monetary calculations... That said, I think this more than anything else requires a proper RFC and discussion. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/