Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18843 invoked from network); 19 May 2017 11:52:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2017 11:52:45 -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:43523] helo=mail.marcodor.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/58-23431-98CDE195 for ; Fri, 19 May 2017 07:52:42 -0400 Received: from DESKTOP9R8I199 (host-static-93-115-138-66.moldtelecom.md [93.115.138.66]) by mail.marcodor.com (Postfix) with ESMTPSA id BF2FB6C4776; Fri, 19 May 2017 14:52:37 +0300 (EEST) To: "'Adam Baratz'" Cc: References: <000601d2cff3$bbffc5f0$33ff51d0$@marcodor.com> In-Reply-To: Date: Fri, 19 May 2017 14:52:38 +0300 Organization: Marcodor Message-ID: <001001d2d096$69fa0330$3dee0990$@marcodor.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0011_01D2D0AF.8F47FE80" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKui4TWyrBa+Xk+uOoGXxI7mVHe7wIi1HjYAym2+eWgGa+LcA== Content-Language: ro DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marcodor.com; s=dkim; t=1495194757; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references; bh=kcs6ESmYokg0MiXLFKAosVXzpl647sqwlFK7CDx3P+o=; b=ezA8PfghuuEpEPCGz1SFjFcO73KKF8PNW0Kg0BzKX3SrAyeW1naW49a+gBS93PWggNWpAA jORoKH+xOycsEF/1syGJqu+G+Wk7i/IYKG/9JgZNKoBZfWoh5IcfibhR8KZX168I2siz8Y rRotLp7B8xL+PmHaMY7v7YrWG5BK7b+7PBmL+Z7gCBWngl6X+qhaR3lQ29Xa1Wg7dBtwUr 5tItB/Ljr0XrD6sxdDzzF6Lh+NJimSwsaDVSxEMUc7YSYGRP/Z44Y6cSkO46uaMxfGq82r Ue8ylIMP8WGGFNnoPf511IsLjsbgu9n9oHeljIRcgDeUXlKldry22IMr5hwyGA== Subject: RE: PDO Parameter types // PDO::PARAM_AUTO From: dorin.marcoci@marcodor.com ("Dorin Marcoci") ------=_NextPart_000_0011_01D2D0AF.8F47FE80 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Adam, =20 From: Adam Baratz [mailto:adambaratz@php.net]=20 Sent: Friday, May 19, 2017 1:26 PM 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. =20 I'm not sure that changes the proposal too much. My position is still = that I'd like PDO to be less "magical," to put more of the burden on = providing the right content to the user.=20 =20 =20 =20 =20 =20 =20 =20 Much of PHP internals are about providing a light layer on a third-party = library (in this case, all the DB libraries). You can then compose them = as needed to get the right functionality for your application. We get a = lot of power and flexibility from that. Making APIs that are too = "opinionated" makes it harder for users to control their destiny. =20 I haven't tested this, but I think you could implement the functionality = you need in userland. You could write a class like this: =20 class MyPDOStatement extends \PDOStatement { public function bindValue($parameter, $value, $data_type =3D -1) { // = or define a const somewhere for an AUTO type if ($data_type =3D=3D -1) { switch (gettype($value) { case 'boolean': $data_type =3D \PDO::PARAM_BOOL; break; default: $data_type =3D \PDO::PARAM_STR; break; =20 ------=_NextPart_000_0011_01D2D0AF.8F47FE80--