Board index » delphi » Caching Problem???

Caching Problem???

I have two instances (App1 & App2) of a BDE application running
in a single machine. The second one is in a different directory but
uses the same data with the first one.  I am doing this to
pseudo-simulate a peer-to-peer situation.

LOCAL SHARE is set to TRUE
Each app uses its own PRIV directory  ..<AppPath>\PRIV
NET DIR is my C:\ (root)

App1 displays a DBGrid giving access to Table1. Rec_1 is displayed.
App2 displays a master(table1)/detail(Table2) relationship.
Rec_1 is also selected in the master table.

App1 deletes Rec_1 successfully.
App2 enters into insert state for the detail table and
adds a new record. I am expecting an exception here, since when
i enter into edit mode for the detail table, I am accessing
(by code) the record in the master table which is already deleted.

Is this a caching problem??? Will it be happen in a real peer to peer
situation?

--
***************************************************home****
* Fotis Kokkoras - PhD Student                            *
* Department of Informatics - Aristotle University        *
* Thessaloniki  540 06 - GREECE                           *
***********************************************************

 

Re:Caching Problem???


In article <397D0585.1EEB7...@csd.auth.gr>, kokko...@csd.auth.gr says...

Quote

> I have two instances (App1 & App2) of a BDE application running
> in a single machine. The second one is in a different directory but
> uses the same data with the first one.  I am doing this to
> pseudo-simulate a peer-to-peer situation.

> LOCAL SHARE is set to TRUE
> Each app uses its own PRIV directory  ..<AppPath>\PRIV
> NET DIR is my C:\ (root)

> App1 displays a DBGrid giving access to Table1. Rec_1 is displayed.

> App2 displays a master(table1)/detail(Table2) relationship.
> Rec_1 is also selected in the master table.

> App1 deletes Rec_1 successfully.
> App2 enters into insert state for the detail table and
> adds a new record. I am expecting an exception here, since when
> i enter into edit mode for the detail table, I am accessing
> (by code) the record in the master table which is already deleted.

> Is this a caching problem??? Will it be happen in a real peer to peer
> situation?

The problem is that the rows displayed in a dbgrid exist in an internal
cache. To solve your problem, before edit/insert rows in the detail
table, you have to locate the master record through another dataset
pointing to the master table.

-------------------------------
Paul Lambadaris
Singular Computer Applications
mailto : p...@singular.gr
www    : http://www.singular.gr

Re:Caching Problem???


Quote
Paul Lambadaris wrote:

> The problem is that the rows displayed in a dbgrid exist in an
> internal cache. To solve your problem, before edit/insert rows in
> the detail table, you have to locate the master record through
> another dataset pointing to the master table.

Paul,

I don't use the DBGrid to get data from the master reccord. I am
using the TTable directly. I guess it is also cached (??). Do
Windows (98) cache the table two times? One for App1 and a second for
App2?

If I use another TTable pointing to the master table, then I will
have to synchronize the two datasets.

????t

--
***************************************************home****
* Fotis Kokkoras - PhD Student                            *
* Department of Informatics - Aristotle University        *
* Thessaloniki  540 06 - GREECE                           *
* ------------------------------------------------------- *
* URL: http://www.csd.auth.gr/~lpis/people/fotis.html     *
***********************************************************

Re:Caching Problem???


Quote
>App1 deletes Rec_1 successfully.
>App2 enters into insert state for the detail table and
>adds a new record. I am expecting an exception here, since when
>i enter into edit mode for the detail table, I am accessing
>(by code) the record in the master table which is already deleted.

>Is this a caching problem??? Will it be happen in a real peer to peer
>situation?

It is a problem with BDE having the records you see cached in memory.
You can put a table1.refresh in the table2.beforeEdit and BeforeInsert methods
to make sure that table 1gets refreshed before you can edit a record in table2

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Caching Problem???


In article <397D63BB.8DE70...@csd.auth.gr>, kokko...@csd.auth.gr says...
Quote

> I don't use the DBGrid to get data from the master reccord. I am
> using the TTable directly. I guess it is also cached (??). Do
> Windows (98) cache the table two times? One for App1 and a second for
> App2?

> If I use another TTable pointing to the master table, then I will
> have to synchronize the two datasets.

No you don't have to, just locate the master record in the BeforeEdit/
BeforeInsert event handlers, if this fails raise an exception

-------------------------------
Paul Lambadaris
Singular Computer Applications
mailto : p...@singular.gr
www    : http://www.singular.gr

Other Threads