Req #62493 [Opn->Dup]: Need alternative to Perl DBH::pg_placeholder_dollaronly
| From: | adambaratz@php.net | Date: | Wed, 01 Mar 2017 22:46:45 +0000 |
| Subject: | Req #62493 [Opn->Dup]: Need alternative to Perl DBH::pg_placeholder_dollaronly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207646@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62493&edit=1
ID: 62493
Updated by: adambaratz@php.net
Reported by: shellgen at gmail dot com
Summary: Need alternative to Perl
DBH::pg_placeholder_dollaronly
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
-Package: PDO related
+Package: PDO PgSQL
Operating System: Linux
PHP Version: 5.4.4
Block user comment: N
Private report: N
New Comment:
See #71885.
Previous Comments:
------------------------------------------------------------------------
[2012-07-06 11:39:24] shellgen at gmail dot com
Description:
------------
Sometimes statements for pgsql may contain operators that contain symbols '?' or
'::', would be really great to have an option like Perl
pg_placeholder_dollaronly and not to treat those symbols as placeholders.
Test script:
---------------
Create some_table in Postgres:
CREATE TYPE some_type AS (
some_column hstore
);
CREATE TABLE some_table OF some_type;
<?php
$dbh = new PDO("pgsql:dbname=some_database;host=some_host", 'some_user',
'some_password' );
$sth = $dbh->prepare('SELECT * FROM some_table WHERE some_column ? :some_param');
$sth->execute(array(':some_param' => 'some_criteria'));
...
And right here we get of course
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid
parameter number: mixed named and positional parameters'
Expected result:
----------------
For statement like
SELECT * FROM some_table WHERE some_column ? :some_param
would be great to be able to tell PDO not to parse '?' and ':' as placeholders
in some cases
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62493&edit=1