Board index » delphi » Cached updates Master/Detail problem

Cached updates Master/Detail problem

Hi all,

I have two Querys ,Master and Detail
and set Property CachedUpdates on true.
When I call
QueryMaster.Insert
QueryDetail.Insert

and do some changes I apply cached updates:

  Database1.StartTransaction;
  try
     QueryMaster.ApplyUpdates;
     QueryDetail.ApplyUpdates;
     Database1.Commit;
  except
     QueryMaster.CancelUpdates;
     QueryDetail.CancelUpdates;
     Database1.Rollback;
  end;

Applying updates on Master query is o.k.
but before program tries to apply Detail Query
UpdatesPending is false and so no
OnUpdateRecord of QueryDetail event is called.

Any suggestions?

Thanks
Duplak Peter

 

Re:Cached updates Master/Detail problem


Quote
Peter Duplak wrote:
> Hi all,

> I have two Querys ,Master and Detail
> and set Property CachedUpdates on true.
> When I call
> QueryMaster.Insert
> QueryDetail.Insert

In QueryDetail.BeforeInsert & BeforeEdit event
  call QueryMaster.CheckBrowseMode;
Quote

> and do some changes I apply cached updates:

>   Database1.StartTransaction;
>   try
>      QueryMaster.ApplyUpdates;
>      QueryDetail.ApplyUpdates;
>      Database1.Commit;
>   except
>      QueryMaster.CancelUpdates;
>      QueryDetail.CancelUpdates;
>      Database1.Rollback;
>   end;

> Applying updates on Master query is o.k.
> but before program tries to apply Detail Query
> UpdatesPending is false and so no
> OnUpdateRecord of QueryDetail event is called.

> Any suggestions?

> Thanks
> Duplak Peter

Re:Cached updates Master/Detail problem


On Mon, 15 Mar 1999 15:34:52 +0100, Peter Duplak

Quote
<pj...@atlas.cz> wrote:
>Hi all,

>I have two Querys ,Master and Detail
>and set Property CachedUpdates on true.
>When I call
>QueryMaster.Insert
>QueryDetail.Insert

>and do some changes I apply cached updates:

>  Database1.StartTransaction;
>  try
>     QueryMaster.ApplyUpdates;
>     QueryDetail.ApplyUpdates;
>     Database1.Commit;
>  except
>     QueryMaster.CancelUpdates;
>     QueryDetail.CancelUpdates;
>     Database1.Rollback;
>  end;

I do
        DataBase1.ApplyUpdates(QueryMaster, QueryDetail);

Then in the OnApplyUpdates of QueryMaster do:
QueryDetail.ApplyUpdates
QueryDetail.CommitUpdates <- Not positive of the Method, but
it doesn't commit the DB transaction, just the changes to
the cache.

This won't work for cascading deletes, you have to Apply the
detail then the master.

Iman L. Crawford
g n i c   a t   a r n   d o t   n e t

'If you don't rate, just over compensate'
'.. if you lack style make up for it in denial'
- Offspring

Other Threads