#34861 [Opn->Csd]: No documented way for PDO to escape a colon
ID: 34861
Updated by: wez@php.net
Reported By: todd at bluecliff dot net
-Status: Open
+Status: Closed
Bug Type: PDO related
Operating System: FreeBSD
PHP Version: 5.0.5
New Comment:
This was fixed in 5.1 a while back.
Previous Comments:
------------------------------------------------------------------------
[2005-10-14 19:51:37] 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 13:41:47] 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-13 21:21:24] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34861&edit=1
Thread (4 messages)