in reply to DBI:MYSQL placeholders and full text searches
"IN BOOLEAN MODE" should definitely not be in there. Those are keywords. The replaceable parameters can *only* replace literals (and then, only some litarals). If anything works, it's
my $table_lit = $dbh->quote_identifier( $table ); my $stmt = qq{ SELECT * FROM $table_lit WHERE ( MATCH( Author ) AGAINST( ? IN BOOLEAN MODE ) ) ORDER BY Title }; ... $sth->execute('+herman +melville');
If the above doesn't work, the following will definitely work:
my $table_lit = $dbh->quote_identifier( $table ); my $pattern_lit = $dbh->quote( '+herman +melville' ); my $stmt = qq{ SELECT * FROM $table_lit WHERE ( MATCH( Author ) AGAINST( $pattern_lit IN BOOLEAN MODE ) ) ORDER BY Title }; ... $sth->execute();
Update: Added backup method.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBI/DBD::mysql placeholders and full text searches
by Gnat53 (Novice) on Sep 29, 2008 at 01:50 UTC | |
by ikegami (Patriarch) on Sep 29, 2008 at 02:04 UTC | |
by Tanktalus (Canon) on Sep 29, 2008 at 04:05 UTC | |
by Gnat53 (Novice) on Sep 29, 2008 at 11:46 UTC | |
by ikegami (Patriarch) on Sep 29, 2008 at 12:21 UTC | |
by ikegami (Patriarch) on Sep 29, 2008 at 02:06 UTC |