Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: sveta.smirnova [...] oracle.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 4.004
Fixed in: 4.024



Subject: Parser is confused by quotes in comments
Download (untitled) / with headers
text/plain 840b
Originally reported by Raphael Hertzog at http://bugs.mysql.com/bug.php?id=27625 Description: I'm forwarding a bug reported to the Debian bug tracking system. http://bugs.debian.org/311040 The SQL parser is apparently confused by single quotes in comments. Example of problematic SQL query: -- 'Tis the quote that confuses DBI::MySQL SELECT ? DBD::MySQL will miss the "?", and assume there's no parameter to bind. Note that the syntax is valid, and the MySQL server has no problem parsing it (if you replace "?" with something else). How to repeat: $ perl -MDBI -lwe 'print DBI->connect("DBI:mysql:mysql_read_default_file=~/.my.cnf")->selectrow_array("-- \x27 \n SELECT ?", undef, 42)' DBD::mysql::db selectrow_array failed: called with 1 bind variables when 0 are needed at -e line 1. See original bug report for more details.
Download (untitled) / with headers
text/plain 189b
Thanks for the bug report. I've added a test here, on latest DBD::mysql the problem no longer exists: https://github.com/perl5-dbi/DBD-mysql/commit/434205de50fd710586b35e388f2c99725b8e443b
Subject: test t/rt83494-quotes-comments.t doesn't skip on missing database
Hello MICHIELB, The test t/rt83494-quotes-comments.t fails if no database is available, instead of skipping like other tests. t/91errcheck.t ....................... skipped: ERROR: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can't continue test t/99_bug_server_prepare_blob_null.t .. skipped: ERROR: DBI connect('test;mysql_server_prepare=1','nagios',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at t/99_bug_server_prepare_blob_null.t line 16. t/pod.t .............................. ok t/rt83494-quotes-comments.t .......... DBI connect('test','nagios',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at t/rt83494-quotes-comments.t line 19. t/rt83494-quotes-comments.t .......... 1/10 Can't call method "prepare" on an undefined value at t/rt83494-quotes-comments.t line 30. t/rt83494-quotes-comments.t .......... Dubious, test returned 255 (wstat 65280, 0xff00) Installing version CAPTTOFU/DBD-mysql-4.024, the tests are all skipped/ok which passes the test suite. Thanks Thomas
Download (untitled) / with headers
text/plain 1.3k
Hi Thomas, On Wed Dec 04 10:32:22 2013, TFPBL wrote: Show quoted text
> > The test t/rt83494-quotes-comments.t fails if no database is > available, instead of skipping like other tests. > > t/91errcheck.t ....................... skipped: ERROR: Can't connect > to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) > Can't continue test > t/99_bug_server_prepare_blob_null.t .. skipped: ERROR: DBI > connect('test;mysql_server_prepare=1','nagios',...) failed: Can't > connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) at t/99_bug_server_prepare_blob_null.t > line 16. > t/pod.t .............................. ok > t/rt83494-quotes-comments.t .......... DBI > connect('test','nagios',...) failed: Can't connect to local MySQL > server through socket '/var/lib/mysql/mysql.sock' (2) at t/rt83494- > quotes-comments.t line 19. > t/rt83494-quotes-comments.t .......... 1/10 Can't call method > "prepare" on an undefined value at t/rt83494-quotes-comments.t line > 30. > t/rt83494-quotes-comments.t .......... Dubious, test returned 255 > (wstat 65280, 0xff00) > > Installing version CAPTTOFU/DBD-mysql-4.024, the tests are all > skipped/ok which passes the test suite.
Thanks for your suggestion. I've improved the test code here: https://github.com/perl5-dbi/DBD-mysql/commit/7dd8c59605d0b90ac0a4b32f3e952f7a292e9705 -- Mike


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.