escaping % AND \%



I have a very simple search using ILIKE and binding like:

$sth->execute( '%' . $user_input . '%' );


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 '\\%'.

I suppose the easy thing is to s/$esc//g first. What's the approach
if the $esc is a valid character for the column data?



--
Bill Moseley
moseley@xxxxxxxx

.