[Dbix-class] lower on column and query

Jonathan Rockway jon at jrock.us
Fri Feb 29 22:11:01 GMT 2008


* On Fri, Feb 29 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?

Interestingly, we were discussing this on IRC yesterday and didn't come
up with a good answer.  I ended up doing:

   $rs->search({
       "UPPER(column)" => uc $variable,
   });

This has some problems, including not working with quoting enabled, and
the potential mismatch between UPPER() and uc.  It works for me with
ASCII on SQLite, though, so it's what I'm using :)

Regards,
Jonathan Rockway




More information about the DBIx-Class mailing list