Guenter Wildmann | 10 Dec 2010 14:25
Picon
Picon

or and combine missing

Hello!

Why are the or and combine methods missing in SimpleORM 3.x? What is the
best practice to use if the condition can not be created whith the
methods available?

Ciao, Guenter

------------------------------------

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:
    SimpleORM-digest <at> yahoogroups.com 
    SimpleORM-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
(Continue reading)

Franck Routier | 10 Dec 2010 16:51
Favicon

Re: or and combine missing

Hi,

> Why are the or and combine methods missing in SimpleORM 3.x?

No specific reason AFAIK, they are just not implemented :-)

By combine, do you mean UNION ?

>  What is the
> best practice to use if the condition can not be created whith the
> methods available?

You can use the rawPredicate method, or even the rawSql...

Franck

------------------------------------

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)

(Continue reading)

Guenter Wildmann | 11 Dec 2010 10:17
Picon
Picon

Re: or and combine missing

Hello Franck,

In 2.x there were the .or and .combine methods. (.combine and
.combineEnd for opening bracket and closing bracket in where-condition).
If there is no design-issue for not implementing this methods, i would
like to have them back. The same with the extra_DLL possibility as i try
to use SimpleORM as 'single source of truth'.

Ciao, Guenter

===========================
Hi,

> Why are the or and combine methods missing in SimpleORM 3.x?

No specific reason AFAIK, they are just not implemented :-)

By combine, do you mean UNION ?

> What is the
> best practice to use if the condition can not be created whith the
> methods available?

You can use the rawPredicate method, or even the rawSql...

Franck

------------------------------------

Yahoo! Groups Links
(Continue reading)

anthony | 13 Dec 2010 02:25

Re: Re: or and combine missing

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

At 07:17 PM 11/12/2010, Guenter Wildmann wrote:
(Continue reading)

Steeve St-Laurent | 13 Dec 2010 03:17
Picon

Re: Re: or and combine missing

Hi,

For query building i think maximum flexibility is needed. I implemented a solution based on reverse polish
notation. I'll show code in next post. 

Steeve

------------------------------------

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:
    SimpleORM-digest <at> yahoogroups.com 
    SimpleORM-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
(Continue reading)

Franck Routier | 26 Jan 2011 10:45
Favicon

Re: Re: or and combine missing

Hi Steeve,

did you find the time to post your code ? I am very interested in
looking at it...

Thanks,

Franck

Le dimanche 12 décembre 2010 à 21:17 -0500, Steeve St-Laurent a écrit :
>   
> Hi,
> 
> For query building i think maximum flexibility is needed. I
> implemented a solution based on reverse polish notation. I'll show
> code in next post. 
> 
> Steeve
> 
> 
> 

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
(Continue reading)

anthony | 6 Feb 2011 06:17

Re: Re: or and combine missing

Hmm.

Reverse polish would neatly solve the conflict between a simple linear approach and a awkward nested one. 
It does not feel as hacky as the infix version with push and pop operators.

But it would also be completely weird in terms of what people expect.  It is also rather error prone if the
operators do not match the things popped and pushed, presumably we would just conjoin whatever was left on
the stack.

I am unclear whether the idea is brilliant or terrible.  Certainly it is interesting.

Some example queries would be good.

Regards,

Anthony

At 07:45 PM 26/01/2011, Franck Routier wrote:
>  
>
>Hi Steeve,
>
>did you find the time to post your code ? I am very interested in
>looking at it...
>
>Thanks,
>
>Franck
>
>Le dimanche 12 décembre 2010 à 21:17 -0500, Steeve St-Laurent a écrit :
(Continue reading)

Steeve St-Laurent | 7 Feb 2011 07:02
Picon

Re: Re: or and combine missing

Hi,

How can i post my code ? Reverse polish is easier to compute, write algo that compute it, but is not a natural way to write query. 

Steeve

Le 2011-02-06 à 00:17, anthony <at> berglas.org a écrit :

 

Hmm.

Reverse polish would neatly solve the conflict between a simple linear approach and a awkward nested one. It does not feel as hacky as the infix version with push and pop operators.

But it would also be completely weird in terms of what people expect. It is also rather error prone if the operators do not match the things popped and pushed, presumably we would just conjoin whatever was left on the stack.

I am unclear whether the idea is brilliant or terrible. Certainly it is interesting.

Some example queries would be good.

Regards,

Anthony

At 07:45 PM 26/01/2011, Franck Routier wrote:
>
>
>Hi Steeve,
>
>did you find the time to post your code ? I am very interested in
>looking at it...
>
>Thanks,
>
>Franck
>
>Le dimanche 12 décembre 2010 à 21:17 -0500, Steeve St-Laurent a écrit :
>>
>> Hi,
>>
>> For query building i think maximum flexibility is needed. I
>> implemented a solution based on reverse polish notation. I'll show
>> code in next post.
>>
>> Steeve
>>
>>
>>
>
>

Dr Anthony Berglas, anthony <at> berglas.org 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.

<7e23f01f.jpg>


__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
anthony | 5 Mar 2011 09:50

Re: Re: or and combine missing

Hello Steeve,

If there is not much of it just zip and email to franck.routier <at> axege.com and anthony <at> berglas.org.  

Alternatively, you can upload it to the Yahoo mailing list site.

In order to be useful it must have some examples/test cases.  Indeed, what would be most useful is some
annotated fragments posted to the list before posting code.

Regards,

Anthony

At 04:02 PM 7/02/2011, Steeve St-Laurent wrote:
>  
>
>Hi,
>
>How can i post my code ? Reverse polish is easier to compute, write algo that compute it, but is not a natural
way to write query. 
>
>Steeve
>
>Le 2011-02-06 à 00:17, <mailto:anthony <at> berglas.org>anthony <at> berglas.org a écrit :
>
>>  
>>
>>Hmm.
>>
>>Reverse polish would neatly solve the conflict between a simple linear approach and a awkward nested
one. It does not feel as hacky as the infix version with push and pop operators.
>>
>>But it would also be completely weird in terms of what people expect. It is also rather error prone if the
operators do not match the things popped and pushed, presumably we would just conjoin whatever was left on
the stack.
>>
>>I am unclear whether the idea is brilliant or terrible. Certainly it is interesting.
>>
>>Some example queries would be good.
>>
>>Regards,
>>
>>Anthony
>>
>>At 07:45 PM 26/01/2011, Franck Routier wrote:
>>> 
>>>
>>>Hi Steeve,
>>>
>>>did you find the time to post your code ? I am very interested in
>>>looking at it...
>>>
>>>Thanks,
>>>
>>>Franck
>>>
>>>Le dimanche 12 décembre 2010 à 21:17 -0500, Steeve St-Laurent a écrit :
>>>> 
>>>> Hi,
>>>> 
>>>> For query building i think maximum flexibility is needed. I
>>>> implemented a solution based on reverse polish notation. I'll show
>>>> code in next post. 
>>>> 
>>>> Steeve
>>>> 
>>>> 
>>>> 
>>>
>>>
>>
>>Dr Anthony Berglas, <mailto:anthony <at> berglas.org>anthony <at> berglas.org 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.
>><7e23f01f.jpg>
>

Dr Anthony Berglas, anthony <at> berglas.org       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:
    SimpleORM-digest <at> yahoogroups.com 
    SimpleORM-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Guenter Wildmann | 14 Dec 2010 07:41
Picon
Picon

Re: or and combine missing

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:
    SimpleORM-digest <at> yahoogroups.com 
    SimpleORM-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

anthony | 15 Dec 2010 01:43

Re: Re: or and combine missing

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, anthony <at> berglas.org       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:
    SimpleORM-digest <at> yahoogroups.com 
    SimpleORM-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Gmane