Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Srdjan Djordjevic
  Where is Srdjan Djordjevic?
 Limassol
 Cyprus
 Srdjan Djordjevic
 To: Ahsan Rana
  Where is Ahsan Rana?
 Lahore
 Pakistan
 Ahsan Rana
 Tags
Subject: RE: Data Session
Thread ID: 187111 Message ID: 188935 # Views: 2 # Ratings: 0
Version: Visual FoxPro 7 Category: Forms
Date: Tuesday, August 12, 2008 5:35:38 PM         
   


> > Due to electric shutdown in our areas, data corruption is a very common problem and I want to close Tables
> > immediately after saving. What I have to do.
> >
> >
> > Hi Ahsan
> >
> > You should seriosely look at implementing buffered editing/saving of tables.
> > I highly reccomend optimistic table buffering (5)
> >
> > Having all tables buffered at all times, and saving all changes at once
> > (preferably wrapped in transaction band) will significantly reduce level of
> > corruption. If app is running in more stable environment you can eradicate
> > corruption all together. If conditions are bad then it will sure reduce it
> > to much lower level.
> >
> > Trick is to wrap up (centralise) saving of all changes to all amended tables
> > into a loop, which occures quickly (some miliseconds) right uppon user pressing some
> > Save button, and then everything going back to buffered 'wait state' mode.
> > (Waiting for next set of changes)
> >
> > While tables are in buffered mode waiting to be updated, then
> > power failure cannot hurt them. In order to have corruption
> > power failure have to actualy coincide with one of users pressing
> > save button.
> >
> > You will always have some spastic users who will actually manage to
> > do just that :) , but probability for corruption will be much much less.
> >
> > HTH
> > Sergio
> >
> >
>
> > Rgds++
> > Sergio
>
> If I use table buffering then I have to use DE where I have a problem, when I install the software other than disigned location it save and retrieve data it uses the table of DE instead of actual table.


That is different problem all together.
You can force DE to open correct tables by changing database property on DE cursors
at run time. DE.BeforeOpenTables() method is good place to handle that.

Actual path should never be hardcoded, but always actually constructed at run time
according to some ini settings. I usually keep just initial path to root of data folder structure in an ini file and then global app objects constract actual path according to that root path plus selected company/year etc.

Then I pass entire DE object as reference from mentioned BeforeOpenTable() method to global app object,
which do that path construction and then fixes cursor object database paths accordingly.

**BeforeOpenTables
oSystem.FixDE(this)

I posted it here recently in one thread, while CetinB also posted one solution
which uses simple function call to do that.

If you don't manage to find this message, pls let me know I will send you my code sample.

HTH
Sergio

ENTIRE THREAD

Data Session Posted by Ahsan Rana @ 8/1/2008 1:09:03 PM
RE: Data Session Posted by Christof Wollenhaupt @ 8/1/2008 1:21:00 PM
RE: Data Session Posted by Marcia Akins @ 8/1/2008 2:33:09 PM
RE: Data Session Posted by Olaf Doschke @ 8/1/2008 5:28:05 PM
RE: Data Session Posted by Ahsan Rana @ 8/2/2008 3:41:50 AM
RE: Data Session Posted by Stefan Wuebbe @ 8/2/2008 8:57:00 AM
RE: Data Session Posted by Ahsan Rana @ 8/4/2008 2:27:09 PM
RE: Data Session Posted by Tamar Granor @ 8/4/2008 10:27:29 PM
RE: Data Session Posted by Stefan Wuebbe @ 8/11/2008 11:15:44 AM
RE: Data Session Posted by Srdjan (Sergio) Djordjevic @ 8/11/2008 7:59:25 PM
RE: Data Session Posted by Ahsan Rana @ 8/12/2008 2:06:46 PM
RE: Data Session Posted by Stefan Wuebbe @ 8/12/2008 2:40:13 PM
RE: Data Session Posted by Srdjan (Sergio) Djordjevic @ 8/12/2008 5:35:38 PM
RE: Data Session Posted by Ahsan Rana @ 8/13/2008 12:49:30 PM
RE: Data Session Posted by Srdjan (Sergio) Djordjevic @ 8/18/2008 2:37:52 PM