[Dbix-class] lower on column and query

Emmanuel Quevillon tuco at pasteur.fr
Mon Mar 3 07:38:33 GMT 2008


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
-------------------------



More information about the DBIx-Class mailing list