Re: Expression w/ pathSpec<operator>pathSpec - ??

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Apr 15 2004 - 10:22:49 EDT

  • Next message: Matt Kerr: "Re: Expression w/ pathSpec<operator>pathSpec - ??"

    Matt Kerr <mat..entralparksoftware.com> wrote:
    > what's the cayenne magic to perform query like ...
    >
    > mysql> select * from MyTable where myColumnA != myColumnB;
    >
    >
    > all the ExpressionFactory methods i see are pathSpec<operator>value
    > but no pathSpec<operator>pathSpec - ?

    In the 1.1 head, matchNotExp() calls this:

            return new ASTNotEqual(new ASTObjPath(pathSpec), value);

        public ASTNotEqual(ASTPath path, Object value) {
            super(ExpressionParserTreeConstants.JJTNOTEQUAL);
            jjtAddChild(path, 0);
            jjtAddChild(new ASTScalar(value), 1);
        }

    One thing you could do is patch or subclass ASTNotEqual to create something
    like

        public ASTNotEqual(String pathSpec1, String pathSpec2) {
            super(ExpressionParserTreeConstants.JJTNOTEQUAL);
            jjtAddChild(new ASTObjPath(pathSpec1), 0);
            jjtAddChild(new ASTObjPath(pathSpec2), 0); // maybe ", 1)" instead?
        }

    but I don't know if there's an easier solution using the new expressions in
    1.1.

    If you're using 1.0, you need to investigate following a similar process
    since I suspect the expression-handling in 1.0 is completely different.



    This archive was generated by hypermail 2.0.0 : Thu Apr 15 2004 - 10:21:02 EDT