Re: Parameterized LIKE expressions ...

From: Cris Daniluk (cris.danilu..mail.com)
Date: Tue Mar 07 2006 - 09:18:07 EST

  • Next message: Andrus Adamchik: "Re: Modeler Icons contribution"

    I thought you could escape the literal or something to get the parser
    to cooperate. I vaguely remember doing this before... though maybe I
    gave up on fromString and switched to ExpressionFactory.

    On 3/7/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > IIRC I just didn't have time to deal with extending the parser to
    > deal with non-atomic literal. If you want to take a shot at it, the
    > JavaCC parser is located under exp/parser/ExpressionParser.jjt.
    > Running "ant jjtree" will update the generated Java classes to match
    > your latest grammar.
    >
    > Andrus
    >
    >
    > On Mar 7, 2006, at 12:01 AM, Gentry, Michael ((Contractor)) wrote:
    >
    > > I know I've asked about this a long time before, but I can't recall
    > > the
    > > responses.
    > >
    > > Should a LIKE expression be allowed to have parameterized expressions?
    > > For example:
    > >
    > > Expression expr = Expression.fromString("name like '$name%'");
    > >
    > > Instead of:
    > >
    > > Expression expr = Expression.fromString("name like '" + name + "%'");
    > >
    > > In my SQL logs for the former, I see:
    > >
    > > LIKE ? [bind: '$name%']
    > >
    > > Not quite what I was trying to accomplish. Of course, you then
    > > need to
    > > consider the issue of the user entering the % sign as part of the
    > > text.
    > > Anyway, If we should allow this, maybe I'll looking into the code
    > > when I
    > > get a chance.
    > >
    > > Thanks,
    > >
    > > /dev/mrg
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 07 2006 - 09:18:08 EST