Board index » delphi » Cached Updates with Master-Detail problem

Cached Updates with Master-Detail problem

I came across an odd problem while converting an app that uses Paradox
tables to one that uses InterBase.  I have two query components that are
arranged in a master detail relationship, call them qryMaster and
qryDetail.  It seems that whenever I do a qryMaster.CheckBrowseMode (to
post any changes made to the local cached master table), any changes
made to qryDetail get lost.  It's like qryDetail's cache gets updated
from the server or something.  If I do a qryDetail.CheckBrowseMode
before the qryMaster.CheckBrowseMode, I still lose any changes made to
qryDetail.

Are there some rules or guidelines to follow when working with cached
updates in a situation like this (master-detail)?  Do I have to do a
qryDetail.ApplyUpdates before I can qryMaster.CheckBrowseMode or
something like that?

The previous Paradox version of the app did not use cached updates or
queries at this point, so I didn't came across this problem before.

Thanks,
Neal
n...@mi-assistant.com

 

Re:Cached Updates with Master-Detail problem


Oh yeah, if it matters, I'm using D3.02 Professional on a win95(osr2)
machine with IB 5.1.

Neel

Quote
Neal O'Connell wrote:
> I came across an odd problem while converting an app that uses Paradox
> tables to one that uses InterBase.  I have two query components that are
> arranged in a master detail relationship, call them qryMaster and
> qryDetail.  It seems that whenever I do a qryMaster.CheckBrowseMode (to
> post any changes made to the local cached master table), any changes
> made to qryDetail get lost.  It's like qryDetail's cache gets updated
> from the server or something.  If I do a qryDetail.CheckBrowseMode
> before the qryMaster.CheckBrowseMode, I still lose any changes made to
> qryDetail.

> Are there some rules or guidelines to follow when working with cached
> updates in a situation like this (master-detail)?  Do I have to do a
> qryDetail.ApplyUpdates before I can qryMaster.CheckBrowseMode or
> something like that?

> The previous Paradox version of the app did not use cached updates or
> queries at this point, so I didn't came across this problem before.

> Thanks,
> Neal
> n...@mi-assistant.com

Re:Cached Updates with Master-Detail problem


Crank up SQL Monitor.  You will probably find that the detail TQuery is
closed, re-parameterized, and opened whenever a parent record is modified.
Using datasets in a master-detail relationship is significantly more
complicated when using cached updates.  The topic is often discussed in this
newsgroup, so you will find several solutions if you poke around.

V/R
Russell L. Smith

Quote
Neal O'Connell wrote in message <35F80CCB.C9B47...@mi-assistant.com>...
>I came across an odd problem while converting an app that uses Paradox
>tables to one that uses InterBase.  I have two query components that are
>arranged in a master detail relationship, call them qryMaster and
>qryDetail.  It seems that whenever I do a qryMaster.CheckBrowseMode (to
>post any changes made to the local cached master table), any changes
>made to qryDetail get lost.  It's like qryDetail's cache gets updated
>from the server or something.  If I do a qryDetail.CheckBrowseMode
>before the qryMaster.CheckBrowseMode, I still lose any changes made to
>qryDetail.

Re:Cached Updates with Master-Detail problem


Apparently, my news provider doesn't go back too far.  I couldn't find any
useful information regarding master-detail with tquery using cached updates.
Can anyone point me to another resource that could help?

Thanks,
Neal
n...@mi-assistant.com

Quote
Russell L. Smith wrote:
> Crank up SQL Monitor.  You will probably find that the detail TQuery is
> closed, re-parameterized, and opened whenever a parent record is modified.
> Using datasets in a master-detail relationship is significantly more
> complicated when using cached updates.  The topic is often discussed in this
> newsgroup, so you will find several solutions if you poke around.

> V/R
> Russell L. Smith

> Neal O'Connell wrote in message <35F80CCB.C9B47...@mi-assistant.com>...
> >I came across an odd problem while converting an app that uses Paradox
> >tables to one that uses InterBase.  I have two query components that are
> >arranged in a master detail relationship, call them qryMaster and
> >qryDetail.  It seems that whenever I do a qryMaster.CheckBrowseMode (to
> >post any changes made to the local cached master table), any changes
> >made to qryDetail get lost.  It's like qryDetail's cache gets updated
> >from the server or something.  If I do a qryDetail.CheckBrowseMode
> >before the qryMaster.CheckBrowseMode, I still lose any changes made to
> >qryDetail.

Re:Cached Updates with Master-Detail problem


I searched in www.dejanews.com for "delphi master detail" and got 121 hits.
Naturally most will be fluff, but there will be some meat somewhere in
there...

V/R
Russell L. Smith

Quote
Neal O'Connell wrote in message <35FD50D7.F7CA4...@mi-assistant.com>...
>Apparently, my news provider doesn't go back too far.  I couldn't find any
>useful information regarding master-detail with tquery using cached
updates.
>Can anyone point me to another resource that could help?

Re:Cached Updates with Master-Detail problem


Quote
Neal O'Connell <n...@mi-assistant.com> wrote:
>Apparently, my news provider doesn't go back too far.  I couldn't find any
>useful information regarding master-detail with tquery using cached updates.
>Can anyone point me to another resource that could help?

I suggest you change to Agent for newsreading (www.forteinc.com) and
connect through your ISP directly to forums.borland.com. That will get
you all the messages and threads that exist, any time you want them.

For your master/query problem, I that you use ApplyUpdates instead of
CheckBrowseMode to post changes made while using cached updates.

Phil Cain

Re:Cached Updates with Master-Detail problem


Quote
>For your master/query problem, I that you use ApplyUpdates instead of
>CheckBrowseMode to post changes made while using cached updates.

ApplyUpdates posts changes in the fields to the database(cache).
CheckBrowseMode posts changes to the field-buffers to the fields.

CheckBrowseMode is helpful, when you want the edits of the current
field-buffer to be posted the underlying field without having changed focus.
E.g. you edit a field and select a menu-item.

Bernd

Other Threads