<div dir="ltr">Hi Ken,<br><br>This works for me - did you try the obvious?<br><div><br>$resultset-&gt;search({ name =&gt; { &#39;like&#39; =&gt; &#39;%\_%&#39; } } )<br><br>cheers,<br>Bob<br><br><br></div><div><br></div></div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 18, 2014 at 7:24 PM, Kenneth Ölwing <span dir="ltr">&lt;<a href="mailto:kenneth@olwing.se" target="_blank">kenneth@olwing.se</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I happen to have text data in my table that has the &#39;_&#39; (underscore) character, and I wanted to do a like search.<br>
<br>
So to find all rows with &#39;_&#39; I did:<br>
<br>
    my @rows = $rs-&gt;search( { data =&gt; { like =&gt; &#39;%_%&#39; } } );<br>
<br>
and running with DBIC_TRACE=1, I see:<br>
<br>
    SELECT me.data FROM test me WHERE ( data LIKE ? ): &#39;%_%&#39;<br>
<br>
I didn&#39;t get the result I was expecting. And duh, it dawned on me that &#39;_&#39; is itself a wildcard char...<br>
<br>
After realising that, I researched and found out that I could write something like this (a direct query):<br>
<br>
    SELECT * FROM test WHERE (data LIKE &#39;%\_%&#39; ESCAPE &#39;\&#39;);<br>
<br>
Being a beginner with DBIx::Class, I may not have found the right place to look, but so far no luck...can I achieve this effect with the Perl code, and if so how? I&#39;m using SQLite for the moment and Perl 5.16 and latest DBIx::Class.<br>


<br>
TIA, any help appreciated.<br>
<br>
ken1<br>
<br>
<br>
-----<br>
No virus found in this message.<br>
Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>
Version: 2014.0.4716 / Virus Database: 3986/7876 - Release Date: 07/18/14<br>
<br>
<br>
______________________________<u></u>_________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-<u></u>bin/mailman/listinfo/dbix-<u></u>class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/<u></u>repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/<u></u>dbix-class@lists.scsys.co.uk</a><br>
</blockquote></div><br></div>