Re: Building null-checking expression without calling objectNode() twice?

From: Mike Kienenberger (mkienen..mail.com)
Date: Tue Aug 22 2006 - 16:18:58 EDT

  • Next message: Mike Kienenberger: "Why is appendObjectMatch (objectMatchTranslator) called late in query translation?"

    Just as an update, I think I have all of this working, almost. I
    wouldn't have guessed it would involve rewriting so much of
    QualifierTranslator when I started.

    The only thing currently failing unit testing is
    DataContextPrefetchTst.testPrefetch9, which is generating sql with a
    missing column name.

    SELECT t0.ESTIMATED_PRICE, t0.PAINTING_DESCRIPTION, t0.PAINTING_TITLE,
    t0.ARTIST_ID, t0.GALLERY_ID, t0.PAINTING_ID FROM PAINTING t0 WHERE ((
    IS NULL) OR t0.ARTIST_ID <> ?)

    On 8/22/06, Mike Kienenberger <mkienen..mail.com> wrote:
    > I'm trying to build the ((exp is null) or (exp <> 'Y')) sql for an inequality.
    >
    > My thought was to stick the following code at the top of startNode,
    > essentially calling the part of Expression.traverse(Expression,
    > TraversalHandler) that generates the left-hand-side twice. Calling
    > the code twice turns out to have bad side effects, like creating
    > multiple joins.
    >
    > if (handleNullInequalityComparison)
    > {
    > qualBuf.append("((");
    >
    > Object child = node.getOperand(0);
    > if (child instanceof Expression) {
    > Expression childExp = (Expression) child;
    > childExp.traverse(node, this);
    > }
    > else {
    > this.objectNode(child, node);
    > }
    >
    > qualBuf.append(" IS NULL) OR ");
    > }
    >
    > So I guess what I need to do is call it once and then cache the value.
    > I'm trying to figure out the best way to do this as well as how to
    > share the cached value since I can't store it in the Expression or the
    > TraversalHandler instance.
    >



    This archive was generated by hypermail 2.0.0 : Tue Aug 22 2006 - 16:19:22 EDT