Master detail problem

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
AdamKG
Posts: 18
Joined: Fri 13 Nov 2009 10:32

Master detail problem

Post by AdamKG » Tue 07 Oct 2014 15:25

Hello,

I want to setup master-detail relation between two TSmartQuery components. However my detail query is a join of two tables and unfortunately both of them have col1 column. When I put MasterFields and DetailFields and write my own detail query with parameter I have it rewrited in TCustomDADataSet.GetFinalSQL in a way like SELECT a1.col1, a1.col2, a2.col3 FROM a1, a2 WHERE (a1.col1 = a2.col1 and a1.col1 = :col1) AND COL1 = :COL1
And Oracle throws error because col1 is in both a1 and a2 tables

My question is how can I disable auto generating detail sql. I want to provide my own query.
I see that there is another way to set up master detail relationship in ODAC. Not filling any of MasterFields and DetailFields at all and provide detail query, but when I do that I don't get my detailfields auto populated on new record from master dataset and If I understand documentation I should expect this so maybe it's a bug.

I use 9.4.12, in Delphi XE3

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Master detail problem

Post by AlexP » Wed 08 Oct 2014 09:40

Hello,

Thank you for the information. We have reproduced and fixed this behavior. This fix will be included into the next version. Now, to set DetailFields, field name with table name are required, i.e.: DetailFields := 'a1.col1'.

Post Reply