On Nov 9, 8:00 am, bsdev <[email protected]> wrote:
> Hello!
>
> I have a problem building a SQL query with sequel.
> This is the query I want to get:
> select "ID", "NAME", "CITY" from "USER" where lower("EMAIL") =
> 'mailaddress' or lower("NAME") like 'i%' or lower("CITY") like 'l%';

  DB[:USER].
   select(:ID, :NAME, :CITY).
   filter{{lower(:EMAIL)=>'mailaddress'} |
    lower(:NAME).like('i%') |
    lower(:CITY).like('l%')}

Phrogz's methods should also work fine.

> Also I did not find how to set the columns to lower case.

  DB.identifier_output_method = :downcase
  DB.identifier_input_method = :upcase

That should return identifiers in lower case, and upper case them when
submitting them in queries.  It should allow you to keep upper case
identifiers in the database, while dealing with the identifiers in
lower case in your ruby code.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to