D2 / D1(not the patch) have some serious problems in handling master -
detail - detail
queries. I wonder if any one else has noticed this.
Client : Delphi 2.0, Win95, MSSQL 6.0 Client (Named Pipes).
Server : WinNT 3.51, MS SQL 6.0.
Three database tables,
table1 (field1 int, field2 varchar (255)), primary key = field1
table2 (field1 int, field2 int, field3 varchar (255)), primary key =
field1, field2, fkey = field1 on table1.
table3 (field1 int, field2 int, field3 int, field4 varchar (255)),
primary key = field1, field2, field3,
fkey = field1, field2 on table2.
Record distribution is a 1 : 10 ratio. (10 detail records for each parent
record, with master table containing 10 records).
Query1.SQL =
"Select * from table1". "
Query2.SQL =
"Select * from table2 where field1 = :field1"
Query3.SQL=
"Select * from table3 where field1 = :field1 and field2 = :field2"
Datasource1.Dataset := Query1.
Datasource.Dataset := Query2.
Datasource.Dataset := Query3.
Query2.Datasource := Datasource1.
Query3.Datasource := Datasource2.
Three DBGrids (DBGrid1.Datasource := Datasource1, DBGrid2.Datasource :=
Datasource2,
DBGrid3.Datasource := Datasource3).
Open all three queries (Query1.Open, Query2.Open, Query3.Open). Scrolling
down in DBGrid2 reveals that Delphi / BDE fetches only the no. of rows
from Query2 that are visible in the grid.
If no grid is present (use only edit controls & a navigator) only one row
from Query2 is fetched.
If the grid is extended (at design time to show 5 rows), 5 rows are
fetched from the tables.
Any comments from TeamB on this? Is it fixed in the Delphi 2.01 upgrade?
Vimal.