Re: split expressions

From: Lachlan Deck (lachlan.dec..mail.com)
Date: Wed Jan 13 2010 - 21:11:33 EST

  • Next message: Andrus Adamchik: "Re: split expressions"

    On 13/01/2010, at 11:19 PM, Andrus Adamchik wrote:

    > On Jan 13, 2010, at 2:14 PM, Andrus Adamchik wrote:
    >
    >> On Jan 13, 2010, at 2:02 PM, Andrus Adamchik wrote:
    >>
    >>> paintings.exhibits.start > $date1 AND paintings.exhibits.name like 'X%'
    >>> OR
    >>> paintings.exhibits.start < $date2 AND paintings.exhibits.name like 'Y%'
    >>> OR
    >>> paintings.exhibits.start = $date3 AND paintings.exhibits.name like 'Z%'
    >>>
    >>> here you can't describe the desired behavior with "|", but can with aliases:
    >>>
    >>> a.start > $date1 AND a.name like 'X%'
    >>> OR
    >>> b.start < $date2 AND b.name like 'Y%'
    >>> OR
    >>> c.start = $date3 AND c.name like 'Z%'
    >>
    >> Wonder if that's a bad example though, as the intended result can be obtained without splits... Need to think of a better one. Although the idea is that there can be cases when exact control over joins is needed.
    >>
    >> Andrus
    >
    > How about this (looking for artists that have multiple paintings with multiple exhibits, each matching its own set of criteria) :
    >
    > a.start > $date1 AND a.name like 'X%'
    > AND
    > b.start < $date2 AND b.name like 'Y%'
    > AND
    > c.start = $date3 AND c.name like 'Z%'

    Yes, I see the need for control. However (again) perhaps this could be an additional arg telling the framework when that's needed without having to specifically name them.
    i.e.,
    Expression a = ExpressionFactory.greaterExp("start", date1).andExp(ExpressionFactory.likeExp("name", "X%");
    Expression b = ExpressionFactory.lessExp("start", date1).andExp(ExpressionFactory.likeExp("name", "X%");
    Expression c = ExpressionFactory.matchExp("start", date1).andExp(ExpressionFactory.likeExp("name", "X%");

    Expression all = a.and(b, Expression.SPLIT_ALIASES) etc

    with regards,

    --
    

    Lachlan Deck



    This archive was generated by hypermail 2.0.0 : Wed Jan 13 2010 - 21:12:13 EST