Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 15262
Status: resolved
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: martin.groenemeyer [...] kochpiraten.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.48
Fixed in: (no value)



Subject: Prepare statement broken if using MATCH ... AGAINST with escaped single quote
We have a problem with the prepare statement. If we use a quoted ' in a MATCH ... AGAINST select, a following 'and id=?' is ignored. See the following code snipped: This fails: <snip> use DBI; my $dsn = "DBI:mysql:database=test;host=localhost"; my $dbh = DBI->connect($dsn, "root"); $dbh->do("DROP TABLE IF EXISTS articles"); $dbh->do(qq{ CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) ) }); $dbh->do(qq{ INSERT INTO articles set title="this is a 'test'",body="name is O'test" }); my $sth = $dbh->prepare("SELECT * FROM articles WHERE MATCH(title,body) AGAINST('O\\\'test') and id=?"); my $rs = $sth->execute(1); </snip> => DBD::mysql::st execute failed: called with 1 bind variables when 0 are needed at test2_mysql.pl line 17. If I change the last lines to: <snip> my $sth = $dbh->prepare("SELECT * FROM articles WHERE id=? and MATCH(title,body) AGAINST('O\\\'test')"); my $rs = $sth->execute(1); </snip> the script runs fine.
[guest - Mon Oct 24 09:30:28 2005]: Sorry, forgotten to say: We are using DBI-1.48 MySQL 5.0.11-beta-standard on a Debian unstable.
This is a DBD::mysql issue and not a DBI issue. Please report it for DBD::mysql. Thanks.