New version of DBD::mysql problems - ? in strings.

M

Matthew Braid

Hi all,

We just did a package upgrade of DBD::mysql to version 3.001 (freebsd
system). All looked ok until one particular example showed a problem
with the quote function - specifically, it wastreating the '?' character
oddly.

Previously this code (with the connection stuff filled in):

my $dbh = DBI->connect(...);
my $query =
"INSERT INTO test (t1, t2) VALUES (?, " . $dbh->quote("?") . ")";
print $query, "\n";
my $sth = $dbh->prepare($query);
$sth->execute('Question Mark');
print "OK!\n";

resulted in:

INSERT INTO test (t1, t2) VALUES (?, '?')
OK!

With version 3.001 of DBD::mysql, this becomes:

INSERT INTO test (t1, t2) VALUES (?, '?')
DBD::mysql::st execute failed: called with 1 bind variables when 2 are
needed

In other words, the ? inside the string is being interpreted as a
binding marker, when it shouldn't.

We've reverted back to the old version (2.9008) and I'm sending this
message (or close to) to the perl mysql list, but its something people
should look out for - was a bit of a weird bug to find :)

MB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top