[Dbix-class] lower on column and query
Moritz Onken
onken at houseofdesign.de
Sat Mar 1 08:36:00 GMT 2008
Interestingly, I thought about the same problem yesterday,
I was looking at the difference of LIKE in postgres and mysql. Seems
like LIKE in postgres is case sensitive and in mysql it's not. So you
have to use ILIKE in postgres to get the same behaviour as LIKE in
mysql.
To make an application independent from its DBMS you need to do
soemthing like "lower(field) LIKE lower(query)" (as emmanuel said).
And I have no idea how I can append a whitespace % to that
lower(query) part :-)
Am 29.02.2008 um 23:11 schrieb Jonathan Rockway:
> * 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
>
>
> _______________________________________________
> 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/dbix-class@lists.rawmode.org
More information about the DBIx-Class
mailing list