Bug #33886 [Com]: PDO Prepared Statement fails if binding id (:blah) is used more then once.
| From: | leif at neland dot dk | Date: | Mon, 21 Mar 2016 14:08:00 +0000 |
| Subject: | Bug #33886 [Com]: PDO Prepared Statement fails if binding id (:blah) is used more then once. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199992@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=33886&edit=1
ID: 33886
Comment by: leif at neland dot dk
Reported by: wb at pro-net dot co dot uk
Summary: PDO Prepared Statement fails if binding id (:blah)
is used more then once.
Status: Wont fix
Type: Bug
Package: PDO related
Operating System: FreeBSD 5.4-RELEASE-p2
PHP Version: 5.0.4
Block user comment: N
Private report: N
New Comment:
Would
$statement = $pdo->prepare("
SET @sql_param=:php_param;
SELECT ... FROM TAB where p=@sql_param or q=@sql_param
");
$statement->execute(array(':php_param' => $php_variable));
work?
Previous Comments:
------------------------------------------------------------------------
[2014-03-18 15:53:56] php at pineight dot com
Use of named placeholders is also not portable, as MySQL supports only positional placeholders, yet
PDO emulates it. Why does PDO emulate named placeholders on MySQL but not emulate repeated
placeholders? Otherwise, applications using PDO will end up littered with passive-aggressive
workarounds:
$args[':skuid_bug33886'] = $args[':skuid'];
$args[':supplierid_bug33886'] = $args[':supplierid'];
------------------------------------------------------------------------
[2005-07-27 16:20:41] wb at pro-net dot co dot uk
Fair enougth.
I will submit a note to the php manual about this.
Keep up the good work :)
------------------------------------------------------------------------
[2005-07-27 16:13:08] wez@php.net
It's not portable to rely on that.
You need to create three parameters and bind them separately.
------------------------------------------------------------------------
[2005-07-27 16:04:28] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-07-27 16:00:07] wb at pro-net dot co dot uk
Using PDO-0.9 and PDO_PGSQL-0.9
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=33886
--
Edit this bug report at https://bugs.php.net/bug.php?id=33886&edit=1