Hi Bill,
On Fri, 29 Jun 2007, Bill Moseley wrote:
The docs show this for escaping SQL pattern chars:
$esc = $dbh->get_info( 14 ); # SQL_SEARCH_PATTERN_ESCAPE
$search_pattern =~ s/([_%])/$esc$1/g;
But if $search_pattern is '\%' then you end up with '\\%'.
If you have a user defined search pattern which is \%, then you can assume
that user wanted to match against the '%' litteral, right? So \\% is what
you'd want, isn't it?
I suppose the easy thing is to s/$esc//g first. What's the approach
Yeah, but that wouldn't match against your \% litteral, which the user
intended - would it?
if the $esc is a valid character for the column data?
then you'd match against '\'. $esc - as above, wouldn't you?
R.