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
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