Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #14124 skipDelimitedStrings bug: sql comments inside quoted strings
Submitted: 2008-06-11 14:11 UTC
From: alec Assigned: quipo
Status: Closed Package: MDB2 (version 2.5.0b1)
PHP Version: 5.2.6 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 32 + 23 = ?

 
 [2008-06-11 14:11 UTC] alec (Aleksander Machniak)
Description: ------------ When we have a query with quoted string containing a string matching sql comment definition, skipDelimitedStrings() can't handle it right, eg.: UPDATE test SET col1='-- some text' WHERE col2=? the solution is to change $ignores array creation order in such function to make comments checking last: $ignores = $this->string_quoting; $ignores[] = $this->identifier_quoting; $ignores[] = $this->sql_comments; but I'm not sure if that's a good solution. Test script: --------------- $options = array(); $dsn = 'pgsql://dbuser:pass@192.168.0.100/dbname'; $query = "UPDATE identities SET signature='-- blahblah' WHERE identity_id=?"; $mdb2 =& MDB2::factory($dsn, $options); if (PEAR::isError($mdb2)) { die($mdb2->getMessage()); } $q = $mdb2->prepare($query); if (PEAR::isError($q)) { die($q->getMessage()); } $mdb2->disconnect(); Expected result: ---------------- no error Actual result: -------------- _skipDelimitedStrings: [Error message: query with an unterminated text string specified]

Comments

 [2008-06-12 11:11 UTC] quipo (Lorenzo Alberton)
absolutely, that was a silly error of mine. Fixed in CVS, thanks.