DBD::mysql 3.001 - Question marks in strings mistaken for bind placeholders

Matthew Braid <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Hi all,

After a recent port upgrade on one of our FreeBSD machines, I noticed that question marks inside strings were being erroneously picked up as bind placeholders, eg, this code (when the appropriate connection parameters are supplied and a table with specs of 'CREATE TABLE test (t1 varchar(255) not null, t2 varchar(255) not null)' has been created):

my $dbh = DBI->connect(...); # FILL ME IN!
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"; 

results in:

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

The previous version we had installed (2.9008) would do this query without problems (and since we have now rolled back the ports, continues to do so).

Is this a new feature of bind placeholders being allowed to exist inside strings (in which case $dbh->quote should quote it out of specialness) or is something broken here?

Ta,
MB


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.