On Jan 12, 7:15 pm, Jeffrey Reinecke <[email protected]> wrote:
> Hey all!  I've got another one for you here.  :)
>
> I have what is actually a very long query full of joins, and I have a filter 
> condition that does a bitwise AND like so:
>
> filter("((relationships.person_1_gender_mask & #{mask}) OR 
> (relationships.person_1_gender_mask IS NULL))")
>
> Now what I first tried doing was:
>
> filter( {:relationships__person_1_gender_mask.& mask} | 
> {:relationships__person_1_gender_mask => nil} )

You have to let Sequel know you are dealing with a number, otherwise
it uses logical or instead of bitwise or:

filter( {(:relationships__person_1_gender_mask.sql_number & mask)
=>mask} | {:relationships__person_1_gender_mask => nil} )

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