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

From: Scott Finnerty (scot..odefuey.com)
Date: Wed May 07 2003 - 00:43:27 EDT

  • Next message: Andrus Adamchik: "Re: [question] Multiple flattened relationships in a single SelectQuery"

    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





    This archive was generated by hypermail 2.0.0 : Wed May 07 2003 - 00:43:18 EDT