Skip Menu |

This queue is for tickets about the SQL-KeywordSearch CPAN distribution.

Report information
The Basics
Id: 27536
Status: new
Priority: 0/
Queue: SQL-KeywordSearch

People
Owner: Nobody in particular
Requestors: MARKSTOS [...] cpan.org
Cc:
AdminCc:

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



Subject: PostgreSQL special RE characters can cause failure
A search with PostgreSQL for terms like: dog ++\; May cause failure. The attached patch fixes it, probably in a PostgreSQL-specific way. If someone can help with a possible fix for MySQL, I'll make a release. Mark
Subject: keyword.patch
-- old-alphasite/perllib/SQL/KeywordSearch.pm 2007-06-11 16:50:48.000000000 -0400 +++ new-alphasite/perllib/SQL/KeywordSearch.pm 2007-06-11 16:50:48.000000000 -0400 @@ -166,12 +166,14 @@ $word = "(^|[[:<:]])".$word.'([[:>:]]|$)'; } push @sql, "lower($columns[$i]) $p{operator} "; + # This business with '***=' is a PostgreSQL-specific extension + # that makes sure $word gets treated as a string literal, not an RE. if ($p{interp}) { - push @sql, "lower(",\$word,")"; + push @sql, "lower(",\('***='.$word),")"; } else { push @sql, "lower(?)\n"; - push @bind, $word; + push @bind, '***='.$word; } } push @sql, " ".($p{every_column} ? 'AND' : 'OR' )." " if $i != $#columns;