Master - Detail in CacheUpdate

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Master - Detail in CacheUpdate

Post by tonisanta » Thu 12 Apr 2007 15:13

Hi,
I've a master-detail relation through detail.MasterSource = master; (TmsQueries) both datasets have CachedUpdates=true; in the detail.AfterDelete-event the master is set in editmode; doing so the detail is requeried and all changes done on detail-records including the delete are missed. This happens only after upgrading to Sdac 4. Delphi7, SQL2k. Should you need a sample, please let me know.
best regards
Toni

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Post by tonisanta » Thu 12 Apr 2007 17:04

Again me,
still if the two datasets (master and detail) are not in cachedUpdates a requery of the detail is launched when setting the master in edit-mode. This could have the unwished effect that a modified detail-record is automatically posted to the database, could be with uncomplete data.
regard, toni

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Fri 13 Apr 2007 14:26

I've a master-detail relation through detail.MasterSource = master; (TmsQueries) both datasets have CachedUpdates=true; in the detail.AfterDelete-event the master is set in editmode; doing so the detail is requeried and all changes done on detail-records including the delete are missed. This happens only after upgrading to Sdac 4. Delphi7, SQL2k. Should you need a sample, please let me know.
Thank you for information.
We have reproduced the problem and fixed it.
This fix will be included in the next build of SDAC 4.
Please watch for announcements at the forum.
still if the two datasets (master and detail) are not in cachedUpdates a requery of the detail is launched when setting the master in edit-mode. This could have the unwished effect that a modified detail-record is automatically posted to the database, could be with uncomplete data.
This is default behaviour. It is compatible with standard data access components such as BDE and ADO.

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Post by tonisanta » Fri 13 Apr 2007 15:18

This is default behaviour. It is compatible with standard data access components such as BDE and ADO.
Your are right; this is the default behaviour. In SDac3.8 it wasn't. This and others also were the reason to use Sdac and not ADO or BDE. Excuse me if this sounds offending: only because ADO has a lot of bugs, SDAC mustn't have them.
My program is build arround SDac3.8. It would be fine to have on Option if editing the master should requery the detail.
Perhaps, do you have any documentation of all this changed behaviours. I would like to avoid they are only discovered by my customers.

Do you have a release date for a new build? Is it possible to download your current source, still if it is in a beta-state? (I've registered the pro)

best regards, Toni

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Mon 16 Apr 2007 11:55

This behaviour is the same both in SDAC 3.80 and in SDAC 4.
When you start editing the master DataSet, the detail DataSet is automatically posted if it was in Edit mode.
Do you mean exactly this behaviour?
If not, please describe the problem in more detail.

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Post by tonisanta » Mon 16 Apr 2007 13:32

With SDAC 3.8 having a master - detail (detail.mastersource=master) launching a master.edit in the detail.beforeinsert- or detail.beforeedit-events did not requery the detail. I mean this behaviour. Now, with SDAC 4 the detail is requeried.
To reproduce: put a MsConnection, 2 MsQuery (master, detail), 2 datasource and 2 grids on a from; connect to Northwind, set master.sql.text='select * from customers', detail.sql.text='select * from orders where customerid=:customerid'; detail.mastersource=master; detail.beforeedit : master.edit; detail.beforeInsert: master.edit; connect datasources and grids; launch and try to change the data of the second detail-record; try to add a detail-record. You 'll see the effects.
best regards. Toni

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 17 Apr 2007 08:18

With SDAC 3.8 having a master - detail (detail.mastersource=master) launching a master.edit in the detail.beforeinsert- or detail.beforeedit-events did not requery the detail. I mean this behaviour. Now, with SDAC 4 the detail is requeried.
To reproduce: put a MsConnection, 2 MsQuery (master, detail), 2 datasource and 2 grids on a from; connect to Northwind, set master.sql.text='select * from customers', detail.sql.text='select * from orders where customerid=:customerid'; detail.mastersource=master; detail.beforeedit : master.edit; detail.beforeInsert: master.edit; connect datasources and grids; launch and try to change the data of the second detail-record; try to add a detail-record. You 'll see the effects.
Thank you for information.
We have reproduced the problem and fixed it.
This fix will be included in the next build of SDAC 4.
Please watch for announcements at the forum.

Post Reply