Should DA4 master table with DA3 detail table using mmWhere work (efficiently)?

Should it be possible to link a DA4 master table with a DA3 detail table?

At present it looks like the generated SQL is not correct although the dataset appears correct

When I link a DA3 to a DA3 table or a DA4 to a DA4 table it fetches the details based on the specified mapping (during scrolling through the master)
However when I link a DA3 to a DA4 it fetches the entire child table

This is how I link the tables

DetailTable.MasterSource:=Self.DataSource;
DetailTable.MasterMappingMode:=mmWhere;
DetailTable.MasterFields:=MasterFields;
DetailTable.DetailFields:=DetailFields;

This is the speed and result in code
[MAINTHR][08-03-2022 09:40:10.929][DEBUG(1)]FirmaBes open:0,004660 sec for 3 records
[MAINTHR][08-03-2022 09:40:11.384][DEBUG(1)]FirmaBes.BesDA3 open:0,454927 sec for 1 records master.fbe_primkey:15 master.fbe_bes_primkey:100061084 child.bes_primkey:100061084
[MAINTHR][08-03-2022 09:40:11.410][DEBUG(1)]FirmaBes.BesDA4 open:0,025631 sec for 1 records master.fbe_primkey:15 master.fbe_bes_primkey:100061084 child.bes_primkey:100061084
[MAINTHR][08-03-2022 09:40:11.968][DEBUG(1)]After FirmaBes.Next FirmaBes.BesDA3 child has 1 records master.fbe_primkey:17 master.fbe_bes_primkey:100061058 child.bes_primkey:100061058
[MAINTHR][08-03-2022 09:40:11.968][DEBUG(1)]After FirmaBes.Next: BesDA4 child has 1 records master.fbe_primkey:17 master.fbe_bes_primkey:100061058 child.bes_primkey:100061058

This is correct behaviour, meaning the correct detail record set is attached but the speed with the DA3 child is bad.
It looks like this is because the entire child table is fetched from SQL
DA3 child SQL:SELECT … FROM Bestelling left join leverancier on lev_Primkey = bes_lev_Primkey order by bes_Datum desc
DA4 child SQL:SELECT … FROM Bestelling left join leverancier on lev_Primkey = bes_lev_Primkey
where (Bestelling.bes_Primkey = 100061084)
order by bes_Datum desc

FYI: A scroll of the master (next) fetches the entire DA3 child table again.

This looks like a bug to me or am I missing something.

Hi,

I think, it is correct behavior because mmWhere mode was added only in DA4 (or in DA5 even) so DA3 knows nothing about this mode and it can’t support it.

I am surprised by your response. We have been using the mmWhere method in DA3 for ages.

Maybe we should verify what is DA3, DA4 and DA5

When I speak of DA3 I mean DA schemas in a delphi RO service that inherits from DARemoteService
In the generated file we see IOffServerService = interface(DataAbstract3_intf.IDARemoteService)

When I speak of DA4 I mean DA schemas in a delphi RO service that inherits from DataAbstractService
In the generated file we see TProductService = class(TDataAbstractService, IProductService)
Sources make me believe this is DA4
{ TDataAbstractService }
{$IFDEF RO_RTTI_Support}
[ROLibraryAttributes(DataAbstract4_Intf.TLibraryAttributes)]
[ROAbstract]
[ROService(‘DataAbstractService’, ‘{4C2EC238-4FB4-434E-8CFF-ED25EEFF1525}’)]
{$ENDIF}
TDataAbstractService = class(TBaseDataAbstractService,

Where are we misaligned?

Hi,

under DA3 I mean DAv3 version that was released almost 17 years ago.


can you show your SQL in DA3 tables? it should be AutoSQL or have ... where {WHERE} ...

Correct, we have WHERE {Where}.

What is the correct terminology for the 2 DA versions I am using?

-Frederic

Hi,

You are using DA3 style instead of DA3 version.


Can you create a simple testcase that reproduces this issue, pls?

you can use DA sample databases (C:\Users\Public\Documents\RemObjects Samples\Database)

I do not really have time for this now. I have created some DA4 duplicate DA schemas to bypass the issue