Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99093 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99490 invoked from network); 18 May 2017 08:06:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2017 08:06:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=dorin.marcoci@marcodor.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dorin.marcoci@marcodor.com; 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:50958] helo=mail.marcodor.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/1C-21791-BF55D195 for ; Thu, 18 May 2017 04:06:21 -0400 Received: from DESKTOP9R8I199 (host-static-93-115-138-66.moldtelecom.md [93.115.138.66]) by mail.marcodor.com (Postfix) with ESMTPSA id EFAFE6C475E; Thu, 18 May 2017 11:06:15 +0300 (EEST) To: "'Matteo Beccati'" , References: <002801d2cd97$63921700$2ab64500$@marcodor.com> In-Reply-To: Date: Thu, 18 May 2017 11:06:17 +0300 Organization: Marcodor Message-ID: <000901d2cfad$a0349c60$e09dd520$@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: AQGmIHpy4RzO8NFDYRluODon0aGvPAIf47PzokIVmoA= Content-Language: ro DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marcodor.com; s=dkim; t=1495094776; h=from:subject:date:message-id:to:mime-version:content-type:content-transfer-encoding:in-reply-to:references; bh=qrhed20oButUl4hxSMRWFaqX6k/YZU5RXTljJ1BDxas=; b=BloJrY0N6iLy+81oQvr3P/yQSO6IJLyIo9tZU8AJ/J2h4pQWT8cdp8vP0akRrWOHKwkoO1 x3o+2V9goFijzd7uecR2XNdq2d7IHariHzwNJtTjaP36Vq1FSGSdW6n+mNv4YkxWCXde2R vGFGPulTflOTqgeZlqG87L7aQvGtd4lyPdC0ggaPThnGSq1npChHEY2O943ZR5VeO0sANn sWtThcujlYAcXZ3Ab8FGT+Ct8IuNaRdswzxmnNhoC/lKNVoWtn3EuJsDfLlkcyWxxaUaPR z3HNInBhz5ls6fhgBiiE/DEF93v7w2YyLYTZvf8Jn+3h1nD/OzpOKi0xMTRfXQ== Subject: RE: [PHP-DEV] PDO Parameter types // PDO::PARAM_AUTO From: dorin.marcoci@marcodor.com ("Dorin Marcoci") Hello Matteo, -----Original Message----- From: Matteo Beccati [mailto:php@beccati.com]=20 Sent: Thursday, May 18, 2017 8:13 AM >> But when implementing FB Boolean data type parameters and doing=20 >> ->bindValue ('bool_param', false) I get an empty string internally. >>=20 >> Yes, true ZVAL is converted as string as '1', but false as an empty=20 >> string, not so consistent here ;) >That's not true. >$p =3D new PDO("pgsql:dbname=3Dpostgres"); >$p->prepare("SELECT ?::bool"); >$s->bindValue(1, false); >$s->execute(); >var_dump($s->fetchColumn());' >outputs: >bool(false) >What are you referring to? I wrote "internally", meaning in C driver code, not in PHP. When a bool ZVAL variable is converted to a string ZVAL. Your example is irrelevant. >> That's why I think, it will be great to have a special type like=20 >> PDO::PARAM_AUTO and a config flag to set it as default instead of = PARAM_STR. >Config flags are evil as it's one more thing you'd need to be aware of = and could change depending on the environment you run your script or = library on. Maybe I was not so explicit, I meant an option flag in PDO constructor = in order to not break existing code, not a hardcoded global config in = php.ini Here: public PDO::__construct ( string $dsn [, string $username [, = string $password [, array $options ]]] ) something like PDO::PARAM_AUTO =3D> true or "server param data types", = we should think for a good name. But I'm with all hands up for making PDO::PARAM_AUTO default in = bindValue, just it may require some small adjustments in all PDO = drivers. If server type params are not supported, treat them as strings. So it = should work. - D.