Re: [question] Multiple flattened relationships in a single SelectQuery

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed May 07 2003 - 01:49:13 EDT

  • Next message: Holger Hoffstätte: "Question about ObjectId"

    Scott,

    Thanks a lot for helping us to keep up with things. I will try out your
    patch in a few days and do some testing.

    ;-)

    Andrus

    On Wednesday, May 7, 2003, at 12:43 AM, Scott Finnerty wrote:

    > I think I experienced the same behavior Laszlo did and spent some time
    > tracking down the issue.
    >
    > In QueryAssemblerHelper at the point it is going to add the column
    > reference
    > for the "end" of the object expression, if there is a relationship in
    > play
    > it is currently just returning the first db relationship that
    > relationship
    > contains - I assume it should rather be the last db relationship in the
    > path.
    >
    > To try to explain with an example...
    >
    > Say you have a data model: A - A_B - B
    > And you have a flattened obj relationship on A: aToB
    > That maps to the db relationship path: aToAB.abToB
    > Suppose you have a query qualifier: aToB.attr = 'some value'
    >
    > QueryAssemblerHelper builds the join off of the db relationship paths
    > creating aliases t1 and t2 for A_B and B respectively.
    >
    > At the point it is handling the 'attr' part - it knows it just
    > processed the
    > relationship aToB and calls processColumn with attr's db attribute and
    > aToAB - thus it comes up with t1.attr - which is incorrect.
    >
    > I assumed that in all cases the call to processColumn should be called
    > with
    > the db relationship at the end of the path - in this case abToB which
    > is
    > associated with the alias t2.
    >
    > I've attached a patch that does this - please review as I'm not sure
    > about
    > the impact this change has on the bigger picture....
    >
    > Scott
    >
    > <QueryAssemblerHelper.patch>



    This archive was generated by hypermail 2.0.0 : Wed May 07 2003 - 01:48:35 EDT