Em 13-06-2012 15:31, Jeremy Evans escreveu:
On Wednesday, June 13, 2012 9:29:54 AM UTC-7, Rodrigo Rosenfeld Rosas wrote:

    I second this. I often want to do queries like (field is not null
    and field <> ''). But when using an ORM, I'd prefer to generate
    such queries with statements like:

    ds.exclude(field: [nil, ''])

    instead of

    ds.exclude(field: nil).exclude(field: '')

    I just think this feels more natural than just converting to
    "field NOT IN (NULL, '')".

    While the SQL IN behavior makes sense given that NULL == NULL is
    the unknown state in Sql, I'd really prefer to use the Ruby
    behavior when doing ORM (ie, nil == nil is true).

    Maybe you could provide some "Sequel.smart_nil_handling_on_in_list
    = true" option?


As I posted earlier, I consider automatically using OR IS NULL for IN incorrect behavior, and I feel the same way (though not as strongly) for AND IS NOT NULL for NOT IN. However, considering that :field=>nil does IS NULL and not = NULL, I can see why some people would find the behavior you propose desirable. I'll probably implement it as an extension instead of a setting, though.

Great!

Thanks,
Rodrigo.

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