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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 + 5 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 08:01:28 2024 UTC