php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34861 No documented way for PDO to escape a colon
Submitted: 2005-10-13 21:21 UTC Modified: 2005-10-14 20:43 UTC
From: todd at bluecliff dot net Assigned:
Status: Closed Package: PDO related
PHP Version: 5.0.5 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: todd at bluecliff dot net
New email:
PHP Version: OS:

 

 [2005-10-13 21:21 UTC] todd at bluecliff dot net
Description:
------------
There is no documented way to escape a colon in PDO.  I understand that there may be a new patch to make this optional, however, I would not like to use the bindParam function, I would just like to escape it outright.  no number of backslashes seem to work.  This bug hints at the problem, however, there is no note on how to escape a : (colon): http://bugs.php.net/bug.php?id=33736&edit=2

Reproduce code:
---------------
// basically just an update on a time field
$sql_query_str = "UPDATE _sif_message_queue SET msg_time_remote='10:53:00' WHERE message_queue_id=".$this->message_queue_id;
			$stmt = $appconnection->prepare($sql_query_str);
			$stmt->execute();

Expected result:
----------------
Query executes successfully

Actual result:
--------------
SQLSTATE[HY093]: Invalid parameter number: no parameters were bound


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-14 13:41 UTC] 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

Works perfectly here:
<?php
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$stmt = $pdo->prepare("UPDATE test SET a = '10:53:00'");
var_dump($stmt->execute());
?>
bool(true)
 [2005-10-14 19:51 UTC] todd at bluecliff dot net
I will try the latest snapshot, but I am also connecting against a Postgresql 8 database with a column type of "TIME", I don't know if that makes a difference in your testing.
 [2005-10-14 20:43 UTC] wez@php.net
This was fixed in 5.1 a while back.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC