Re: Re: or and combine missing
[email protected] Wed, 15 Dec 2010 10:43:26 +1000
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
The work around for this is to use a raw SQL clause. If the requirement is relatively rare, then this is a good trade off between convenience and keeping SimpleOrm simple. So you can still use SimpleORM to manage the objects. Anthony At 04:41 PM 14/12/2010, you wrote: > > >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 > Dr Anthony Berglas, [email protected] Mobile: +61 4 4838 8874 Just because it is possible to push twigs along the ground with ones nose does not necessarily mean that is the best way to collect firewood. ------------------------------------ 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/