I asked a long time back about engine specific escape sequences to sanitize LIKE queries. I got pointed to a neat snippet from the DBI docs but mostly heard "don't use search (or search_like).

>>>>>    $esc = $dbh->get_info( 14 );  # SQL_SEARCH_PATTERN_ESCAPE
>>>>>    $search_pattern =~ s/([_%])/$esc$1/g;

I think the second should probably be amended to:
   $search_pattern =~ s/([_%]|$esc)/$esc$1/g;

Then I can
   $search_pattern . '%'


I'm doing something with some Ajax auto-complete. So I have no choice but to use search like, right? Any other strategies for this that I'm missing?


Thanks!
-Ashley

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to