Mantis - Quercus
Viewing Issue Advanced Details
4713 major always 08-16-11 08:40 06-21-12 13:38
jamesdlow  
nam  
normal  
closed 4.0.14  
fixed  
none    
none  
0004713: Certain Valid MySQL statements fail
Certain mysql statements seem to fail in in Quercus when doing PDO.

A statement like:
update {table} set {column} = 'A string which we\'ve escaped but has a colon :'

This fails because there is a colon in the string after an escaped apostrophe. The strange thing is that it doesn't occur if there are two escape apostrophe's before the colon.

I've managed to track it down to: PDOStatement.parseQueryString where it is checking for colons within a statement. If I remove this check the MySQL query works.
      else if (quote == 0 && ch == ':') {
        parameterCount++;
        name = new StringBuilder();
        continue;
      }

Notes
(0005924)
nam   
06-21-12 13:38   
php/1s1e

colons in quotes should work now:

$stmt = $pdo->prepare("SELECT * FROM test WHERE data = ':a'");
var_dump($stmt->execute());
var_dump($stmt->fetchAll());