Skip Menu |
 

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 1960
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: spamcollector_cpan [...] juerd.nl
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 2.0900
  • 2.0901
  • 2.0902
  • 2.0903
  • 2.1000
  • 2.1001
  • 2.1002
  • 2.1003
  • 2.1004
  • 2.1005
  • 2.1007
  • 2.1006
  • 2.1008
  • 2.1009
  • 2.1010
  • 2.1011
  • 2.1012
  • 2.1013
  • 2.1014
  • 2.1015
  • 2.1016
  • 2.1017
  • 2.1018
  • 2.1019
  • 2.1020
  • 2.1021
  • 2.1022
Fixed in: (no value)



Subject: Broken support for placeholders in double quotes
Download (untitled) / with headers
text/plain 1.9k
q[SELECT "foo?bar", ?] goes wrong. If you hand it "QUUX", the query used is q[SELECT "foo'QUUX'bar", ], which results in a syntax error. This is because double quote support in CountParam (added in 1999), but not in ParseParam, where the actual expansion takes place. Double quotes as string delimiters is mysql-spcific, and not part of the SQL standard. Here's the patch to fix it: --- dbdimp.c.orig 2002-09-18 19:22:23.000000000 +0200 +++ dbdimp.c 2002-09-18 19:41:56.000000000 +0200 @@ -177,25 +177,29 @@ j = 0; while (j < slen) { switch(statement[j]) { + case '"': case '\'': /* * Skip string */ - *ptr++ = statement[j++]; - while (j < slen && statement[j] != '\'') { - if (statement[j] == '\\') { - *ptr++ = statement[j++]; - if (j < slen) { - *ptr++ = statement[j++]; - } - } else { - *ptr++ = statement[j++]; - } - } - if (j < slen) { - *ptr++ = statement[j++]; + { + char end_token = statement[j]; + *ptr++ = statement[j++]; + while (j < slen && statement[j] != end_token) { + if (statement[j] == '\\') { + *ptr++ = statement[j++]; + if (j < slen) { + *ptr++ = statement[j++]; + } + } else { + *ptr++ = statement[j++]; + } + } + if (j < slen) { + *ptr++ = statement[j++]; + } + break; } - break; case '?': /* * Insert parameter ////////////////////////////////////////////////////// First reported in September 2002, by e-mail. JWIED confirmed receiving my message. I wonder if this patch will ever be applied...
Fixed in 2.1024, which I have uploaded some minutes agi.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.