Emmanuel Quevillon wrote:
Hi,

I'd like to perform a query where I'd like to cal SQL funciton on :

select * from foo where lower(field) = lower(query).

So I wondered if from a ResultSet::search method I could pass attribute like 'case => lower' as described in SQL::Abstract::new method?
BTW, I am using PostGreSQL
Thanks
Emmanuel
Hi guys,

Thanks for your replies.
I found a solution equal to Jonathan's one which is :

my $search = $c->req->param('extactmatch') ? 'search' : 'search_like';
$q = lc($q);
my $rs = $c->model("DB::Dbentry")->$search({ 'lower('.$key.')' => $q },

and it works well.

Moritz: Regarding why I am using LIKE and not ILIKE with PostGres, it's is because LIKE is far less slow than ILIKE. I made some benchmarking a while ago and noticed that. Just to let the community know.

Regards
Emmanuel
--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to