On Apr 22, 2009, at 4:25 PM, Paul McNett wrote:

> I think what is happening is that I'm constructing the SQL from clause
> as follows:
>
> 111     self.setFromClause("""prod_cust
> 112  left join product_lines
> 113    on product_lines.id = prod_cust.prod_id
> 114  left join customers
> 115    on customers.id = prod_cust.cust_id""")
>
> The new code in setChildFilter() seems to assume (by using split() 
> [-1])
> that the last word in the from clause is going to be the table alias,
> but in my case the last 'word' is 'prod_cust.cust_id'.
>
> My code above was written prior to dabo having addJoin() and I could
> certainly rewrite it, but I really don't want to have to if it can be
> avoided (there are many bizobjs written this way).

        OK, there are several approaches to take. One is to forbid implicit  
aliases, and require that from clauses be set with a specific alias  
name. Right now I'm parsing the from clause to get the alias, and non- 
standard from clauses like the one above will not work. The other is  
to require that SQL Builder usage follow certain standards, which your  
setFromClause() clearly violates.

        Can you think of any other approach? It would have to handle all of  
the following:

self.setFromClause("prod_cust")
self.setFromClause("prod_cust pc")
self.setFromClause("prod_cust as pc")
self.setFromClause("""prod_cust
        left join product_lines
        on product_lines.id = prod_cust.prod_id
        left join customers
        on customers.id = prod_cust.cust_id""")
self.setFromClause("""prod_cust pc
        left join product_lines
        on product_lines.id = prod_cust.prod_id
        left join customers
        on customers.id = prod_cust.cust_id""")
self.setFromClause("""prod_cust as pc
        left join product_lines
        on product_lines.id = prod_cust.prod_id
        left join customers
        on customers.id = prod_cust.cust_id""")




-- Ed Leafe




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to