Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83467 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82823 invoked from network); 22 Feb 2015 10:45:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2015 10:45:43 -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.114.167 as permitted sender) X-PHP-List-Original-Sender: php@beccati.com X-Host-Fingerprint: 176.9.114.167 spritz.beccati.com Received: from [176.9.114.167] ([176.9.114.167:43828] helo=mail.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/61-09723-553B9E45 for ; Sun, 22 Feb 2015 05:45:42 -0500 Received: (qmail 26829 invoked from network); 22 Feb 2015 10:45:37 -0000 Received: from home.beccati.com (HELO ?192.168.1.202?) (88.149.176.119) by mail.beccati.com with SMTP; 22 Feb 2015 10:45:37 -0000 Message-ID: <54E9B34C.80202@beccati.com> Date: Sun, 22 Feb 2015 11:45:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Yasuo Ohgaki , Adam Baratz CC: "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PDO_DBLIB type handling From: php@beccati.com (Matteo Beccati) On 21/02/2015 23:12, Yasuo Ohgaki wrote: > Hi Adam, > > On Sat, Feb 21, 2015 at 2:22 AM, Adam Baratz wrote: > >> This driver returns all column data as a string, regardless of how it's >> represented in the DB. I created a patch for my own use that syncs up the >> type handling with the behavior of the MSSQL extension. This seems like it >> would be of general use. Does anyone have any feedback before I put >> together an RFC? My main question would be whether people would rather have >> this be the default/only behavior, or whether it should be opted into >> via PDO::ATTR_STRINGIFY_FETCHES. >> > > Databases return "string" data to return correct data in DB. > Most obvious is "NUMERIC" data type. NUMERIC has any precision. > We may have 128 bit INT in near future also. > > So it should return string by default, PHP may convert types into > PHP native types optionally. Not the other way around. IMHO. The default behaviour of mysql/pgsql drivers is to convert to the matching PHP type, if possible. That can be turned off via PDO::ATTR_STRINGIFY_FETCHES => true. If PDO_DBLIB doesn't behave like that, I'd say it's a bug that needs to be fixed, but possibly only applied to a major/minor release due to the BC break. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/