Board index » delphi » Cachedupdates with master/detail tables doesn't work

Cachedupdates with master/detail tables doesn't work

I'm using IB express compnents to access the interbase
tables. I have Master-Detail tables and with the property
cachedupdates=true. When I set
a Starttransaction (IBTransaction) and before committing the edits, inserts
etc. only the master table is updated and not the detail-tables. When I look
at the property UpdatesPending only the master is set to TRUE and the
details are not, even though there were changes on the details.

Is there a workaround or a solution to this problem, if you want to see what
I mean try the DB Demo application installed with D5 the IBMastapp, try to
insert a new order  and some item-lines when you press on the button save
results the item-lines are gone but the master isn't.

Edward

 

Re:Cachedupdates with master/detail tables doesn't work


Do you have the detail conencted to the master through the Datasource property?
If so break that connection before applying the updates.  When you apply updates
to the Master the cursor is 'moved' to the first record to apply.  This happens
even if the current record is the first (BDE works the saem way).  When the
master cursor moves the detail dataset will close and reopen on the new master.
When the detail closes the cache is flushed for the detail losing your updates.
Breaking the tie before applying the updates will solve this since the master
cursor move will no longer move the detail.  This is not a bug but a WAD.

Quote
Edward Baarda wrote:

> I'm using IB express compnents to access the interbase
> tables. I have Master-Detail tables and with the property
> cachedupdates=true. When I set
> a Starttransaction (IBTransaction) and before committing the edits, inserts
> etc. only the master table is updated and not the detail-tables. When I look
> at the property UpdatesPending only the master is set to TRUE and the
> details are not, even though there were changes on the details.

> Is there a workaround or a solution to this problem, if you want to see what
> I mean try the DB Demo application installed with D5 the IBMastapp, try to
> insert a new order  and some item-lines when you press on the button save
> results the item-lines are gone but the master isn't.

> Edward

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Re:Cachedupdates with master/detail tables doesn't work


PMJI

Jeff,

So, if there are pending updates for both the detail and master table, the detail
table should be update first and then the master. I am in the middle of converting a
Paradox app to Delphi5 and IB Express would like to use TQueries and CachedUpdates
rather than figure out how to use TCLientDataSet with Master and detail tables.

I was hoping to find a simple sample program somewhere, but no luck.

- Lou

Quote
"Jeff Overcash (TeamB)" wrote:
> Do you have the detail conencted to the master through the Datasource property?
> If so break that connection before applying the updates.  When you apply updates
> to the Master the cursor is 'moved' to the first record to apply.  This happens
> even if the current record is the first (BDE works the saem way).  When the
> master cursor moves the detail dataset will close and reopen on the new master.
> When the detail closes the cache is flushed for the detail losing your updates.
> Breaking the tie before applying the updates will solve this since the master
> cursor move will no longer move the detail.  This is not a bug but a WAD.

> Edward Baarda wrote:

> > I'm using IB express compnents to access the interbase
> > tables. I have Master-Detail tables and with the property
> > cachedupdates=true. When I set
> > a Starttransaction (IBTransaction) and before committing the edits, inserts
> > etc. only the master table is updated and not the detail-tables. When I look
> > at the property UpdatesPending only the master is set to TRUE and the
> > details are not, even though there were changes on the details.

> > Is there a workaround or a solution to this problem, if you want to see what
> > I mean try the DB Demo application installed with D5 the IBMastapp, try to
> > insert a new order  and some item-lines when you press on the button save
> > results the item-lines are gone but the master isn't.

> > Edward

> --
> Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
> (Please do not email    'Till I lost the peace that dreaming gives
>  me directly unless     I dreamed of the moment of my own death
>  asked.  Thank You)     That no one ever dreams and lives (Marillion)

--
Luis R. Feliz
Information Systems Manager
KRM Risk Management and Insurance Services
http://www.krmrisk.com
ph:559-277-4800 ext 461
fx:559-277-4950
lfe...@krmrisk.com
(remove the word nospam)

Re:Cachedupdates with master/detail tables doesn't work


Quote
Lou Feliz wrote:

> PMJI

> Jeff,

> So, if there are pending updates for both the detail and master table, the detail
> table should be update first and then the master.

That is not always possible.  If both the Matser and the Detail are new, the
master will need posting before the detail if there is a foriegn constraint on
the detail table.  Otherwise when you try to post thedetail you will get an
exception that the constraint is being violated.

Quote
> I am in the middle of converting a
> Paradox app to Delphi5 and IB Express would like to use TQueries and CachedUpdates
> rather than figure out how to use TCLientDataSet with Master and detail tables.

In this case the way the BDE and IBX work is the same.  The easiest way to work
with cached updates when it somes time to apply the updates is to just break the
datasource link between the two, apply the updates and then re establish the
link once commited.

Quote
> I was hoping to find a simple sample program somewhere, but no luck.

> - Lou

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Other Threads