From 1355a8adfdc7cd8df24908a2e8cfb2ca4efb216c Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Sun, 30 Sep 2007 22:59:23 +0300 Subject: [PATCH] Add a failing testcase for http://bugs.debian.org/311040 --- t/comments.t | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) create mode 100755 t/comments.t diff --git a/t/comments.t b/t/comments.t new file mode 100755 index 0000000..50c5ba4 --- /dev/null +++ b/t/comments.t @@ -0,0 +1,45 @@ +# -*- cperl -*- +# Test special characters inside comments +# http://bugs.debian.org/311040 +# http://bugs.mysql.com/27625 + +use strict; +use DBI (); + +use vars qw($test_dsn $test_user $test_password $state); +require "t/lib.pl"; + +while (Testing()) { + my ($dbh, $sth); + # + # Connect to the database + Test($state or + ($dbh = DBI->connect($test_dsn, $test_user, $test_password, + {RaiseError => 0}))); + + my $q; + + # + # Placeholder inside a comment + # + $q = " -- Does the question mark at the end confuse DBI::MySQL?\nselect ?"; + + Test($state or ($sth = $dbh->prepare($q))); + Test($state or ($sth->execute(42))); + Test($state or ($sth->{ParamValues})); + Test($state or ($sth->finish)); + + # + # Quote inside a comment + # + $q = " -- 'Tis the quote that confuses DBI::MySQL\nSELECT ?"; + + Test($state or ($sth = $dbh->prepare($q))); + Test($state or ($sth->execute(42))); + Test($state or ($sth->{ParamValues})); + Test($state or ($sth->finish)); + + # + # Close the database connection + Test($state or ($dbh->disconnect() or 1)); +} -- 1.5.3.2