#34861 [Fbk->Opn]: No documented way for PDO to escape a colon
| From: | todd at bluecliff dot net | Date: | Fri, 14 Oct 2005 17:51:38 +0000 |
| Subject: | #34861 [Fbk->Opn]: No documented way for PDO to escape a colon | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86602@lists.php.net to get a copy of this message | ||
ID: 34861
User updated by: todd at bluecliff dot net
Reported By: todd at bluecliff dot net
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: FreeBSD
PHP Version: 5.0.5
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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