Re: or and combine missing
Guenter Wildmann <[email protected]> Tue, 14 Dec 2010 07:41:32 +0100
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
Hello Anthony,
I am migrating some older projects to SimpleORM 3.x on demand and did
notice that some methods are missing.
The things i do are not complicated, just 'where a=1 and b=1 or a=2 and
c=1' but not solvable by the .in method.
So i do not really need the .combine but the .or method.
I know it is a community-process and if i really like to have some
functionality i have to contribute. As i am only using the framework as
a user i do not know much on the internas and my learning-curve is
rather steep at the moment.
Ciao, Guenter
============================
Hello Guenter,
There is a bit of an issue in that they were rather ugly. But so are the
alternatives.
A cleaner way would be something like
new SQuery().AddOr(SQuery.eq(...), SQuery.eq(...))...
with the tree being built up explicitly rather than with the
.combine/.combineEnd push/pop methods.
However, note that SQuery.eq would need to be a static method, with no
access to the actual query being built until the top level AddOr, which
would hten have to validate it.
I just thought that as queries became that complex, maybe we should
defer to SQL clauses, and keep SimpleOrm simple.
(One thing that might be useful is a specific isEmpty test for (? = ''
OR ? IS NULL). Likewise a fieldNullEq for (? = ? OR (? IS NULL AND ? IS
NULL), and fieldEmptyEq ...).
To me, a bigger challenge, and the one that is very database dependent,
is some function processing with dates and sub-strings for more complex
queries. That certainly would be a mess with the push/pop approach.
What is your use case, and does it really justify an additions? Would
you be prepared to suggest a properly thought out syntax, provide
examples and test cases, and possibly offer an implementation? (Not
hard, but needs doing.)
Regards,
Anthony
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/