Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99114 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71718 invoked from network); 18 May 2017 16:28:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2017 16:28:12 -0000 Authentication-Results: pb1.pair.com header.from=dorin.marcoci@marcodor.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dorin.marcoci@marcodor.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain marcodor.com designates 93.115.138.71 as permitted sender) X-PHP-List-Original-Sender: dorin.marcoci@marcodor.com X-Host-Fingerprint: 93.115.138.71 mail.marcodor.com Received: from [93.115.138.71] ([93.115.138.71:44885] helo=mail.marcodor.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/F5-23431-A9BCD195 for ; Thu, 18 May 2017 12:28:12 -0400 Received: from DESKTOP9R8I199 (host-static-93-115-138-66.moldtelecom.md [93.115.138.66]) by mail.marcodor.com (Postfix) with ESMTPSA id B6EF76C4E15; Thu, 18 May 2017 19:28:07 +0300 (EEST) To: "'Adam Baratz'" , References: In-Reply-To: Date: Thu, 18 May 2017 19:28:08 +0300 Organization: Marcodor Message-ID: <000601d2cff3$bbffc5f0$33ff51d0$@marcodor.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKui4TWyrBa+Xk+uOoGXxI7mVHe76BCy1Ag Content-Language: ro DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marcodor.com; s=dkim; t=1495124887; h=from:subject:date:message-id:to:mime-version:content-type:content-transfer-encoding:in-reply-to:references; bh=Lj5TrAfIgSmSuu0FiF7mxcVGFNWzlc5WI4/ckETXFdY=; b=EGV9KNblpSyaY7XqahbAUFS4etNFwnH7q3Canzy6cIqVNcvazDFGXdhUS3+SyVyvedpREu Iaiv1MiAb/pNpvdkRweBZg1X32RhJsxtI1YnDLoCFZ9q37FXx0XYlOz3fUeKFtNDc6eRou aV/uLrZvi24sW7TCWZDlpqOd7C6cWqBBlbPQeFQ88tiO4m0ZqofYFdkvPvRmLCVUYW0kB1 gYK8CpHWasSxFsRb+ynBqmnVGxfZpi6zcyc73NgEQ5Df6gyBROKETb8dMvnvKOoexqJXQ7 RhIWKEyIVjCH/H4vYJeVdsxEpr9WLgAMr+s9UjCezsT5tvXH8iou+WolBEUTTA== Subject: RE: PDO Parameter types // PDO::PARAM_AUTO From: dorin.marcoci@marcodor.com ("Dorin Marcoci") Hi Adam, > From: Adam Baratz [mailto:adambaratz@php.net]=20 > Sent: Thursday, May 18, 2017 3:23 PM >> That's why I think, it will be great to have a special type like >> PDO::PARAM_AUTO and a config flag to set it as default instead of = PARAM_STR. > The risk with this is queries could lose portability between drivers. = There are differences in the level of information each one can get from = the DB server, and different costs associated with asking. > I think the right model is to have PDO types map directly to SQL = types. That said, the code and documentation don't take a strong stance = on how types should work. And there's not a lot of agreement in the = community, at least as indicated by discussions on this list. Yes, agree about portability. But from other side, it will be a great = benefit for drivers that supports server side prepares, not just = emulation. Maybe even a better way is just to change default param type from = PARAM_STR to PARAM_AUTO in bindValue family routines, without any driver = options or configs. So if drivers supports server prepares with type hinting, OK: treat it = better, if not, push it as a string like is now. Anyway, there is not a documented standard what driver should do when = you pass something like bindValue('param', '', PDO::PARAM_BOOL) or = bindValue('param', 't', PDO::PARAM_BOOL) or bindValue('param', '0', = PDO::PARAM_BOOL) In case if data type is specified, then force it, as dictate the php = code. What do you think? > I agree with Matteo that param hooks might provide a better solution = to the specific problem you're describing. I'm using this way, just now. But I don=E2=80=99t like the way that code ->BindValue('bool_param', false); give me internally in C driver code a string type ZVAL with an empty = value in it, ie transform it to a string ZVAL because of default string = type. Yep, forcing it to be boolean like ->BindValue('bool_param', false, = PDO::PARAM_BOOL); works. Just I want do not care at all about param data types as driver know = expected types better than me. - D.