Currently if we do DB[:items].or(b: 10)  the sql generated would be SELECT 
* FROM items which as the documentation says makes since because "the 
default is WHERE true, and OR would be redundant,". 

The issue with this though is if I want to chain a few or's where an or 
will be added or not depending on options sent by the user. In this case I 
have to find the first 
one to be included and make it a where call then make all other calls or. I 
think it can make sense to have DB[:items].or(b:10) return SELECT * FROM 
items where b = 10 , 
then I can write code like:

db = DB[:items]

# db gets manipulated by some function
db = some_func_that_manipulates_db(db)

# Now I can do this without worry about if db has already had a where 
clause added
db = db.or(b: var1) if var1
db = db.or(c: var2) if var2
etc.

I can't think of a time that I call 'or' and wouldn't want my condition to 
be applied even if there was no where clause initially added so I don't 
think changing this would
break peoples code but maybe I'm missing something.

Looks like a simple change replacing sequel/query.rb:721 from 'self' to '
where(cond, &block)'.

-Marc


-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to