[Dbix-class] Need help with PgSQL fulltext search queries

Moritz Onken onken at houseofdesign.de
Thu May 7 08:28:51 GMT 2009


Am 07.05.2009 um 10:16 schrieb Alex Kapranoff:

> Good day to all!
>
> (this is either a DBIx::Class, SQL::Abstarct or PgSQL fulltext search
> + Perl question)
>
> Can someone please help "+selecting" a function with several  
> parameters?
>
> This is the code we came up with. The problem is, $search_text doesn't
> get quoted when sent to DB server.
>
> '+select'  => [
>   \[q{ts_headline('ru', html, plainto_tsquery('ru', ?), 'StartSel =
> <b>, StopSel = </b>')},
>     [dummy => $search_text],
>   ]],
> '+as'   => ['html_hilited'],

Use dbh for quoting:

$search_text = $rs->result_source->schema->storage->dbh- 
 >quote($search_text);

cheers,

moritz




More information about the DBIx-Class mailing list