[Dbix-class] Using 'like' query with data containing wildcard characters requiring ESCAPE?

kenneth at olwing.se kenneth at olwing.se
Wed Jul 23 10:27:52 GMT 2014


On 23.07.2014 01:01, ilmari at ilmari.org wrote:

> You need to use an arrayrefref to combine literal SQL and bind
> parameters:
>
> $rs->search({ data => { like => [q{? ESCAPE ''}, '%_%'] } });
>
> The SQL::Abstract documentation has more information:
>
> https://metacpan.org/pod/SQL
> 
> [6]::Abstract#Literal-SQL-with-placeholders-and-bind-values-subqueries
>
> And DBIx::Class::ResultSet documents DBIC-specific bind parameter
> details:
>
> https://metacpan.org/pod/DBIx [7]::Class::ResultSet#DBIC-BIND-VALUES

Awesome, thanks a lot. Given that the info *is* there I might have 
figured it out eventually, but I wouldn't bet on it, there's quite a bit 
in this area I have yet to wrap my head around :-)


ken1




More information about the DBIx-Class mailing list