php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62493 Need alternative to Perl DBH::pg_placeholder_dollaronly
Submitted: 2012-07-06 11:39 UTC Modified: 2017-03-01 22:46 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: shellgen at gmail dot com Assigned:
Status: Duplicate Package: PDO PgSQL
PHP Version: 5.4.4 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shellgen at gmail dot com
New email:
PHP Version: OS:

 

 [2012-07-06 11:39 UTC] 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 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-01 22:46 UTC] adambaratz@php.net
-Status: Open +Status: Duplicate -Package: PDO related +Package: PDO PgSQL
 [2017-03-01 22:46 UTC] adambaratz@php.net
See #71885.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC