Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to save data before power failure ?
Message
From
03/01/2002 23:41:18
 
 
To
03/01/2002 18:32:09
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00600557
Message ID:
00600612
Views:
18
Harry,

>Dear All,
> After power failure, when my restaurant program is started again ALL data in the previous session are lost. Is there any way to save data automatically in a fixed time to avoid loss of all data?
>
>Thanks for any suggestion!
>
>Harry


As the others have said, uninterruptible power supplies for all components. A lot of times folks forget to protect devices such as routers, switches and hubs. If they go down you're not going to be able to save over any network.

Also, granularize your processes. Make each segment as small as possible. Depending on the criticality of your data close and re-open tables. That will ensure data gets to disk, which is your best protection.

Investigate transactional programming. Wrapping changes in BEGIN TRANSACTION and END TRANSACTION with ROLLBACK, TABLEREVERT() and TABLEUPDATE() will go a long way towards helping you out.

Invest in RAID for your hard drives or duplexing.

Since you have no idea whatsoever when the next power failure is going to occur you need to treat each and every change as though it could fail.

It actually sounds like you are wanting to recover an incomplete or in-progress transaction. If this is actually the case why not use STRTOFILE() and write it to a recycled TXT file, wrapped with a START/STOP semaphore TXT file? Let me outline this a little for you:

1) Start New Trabnsaction

2) Does an existing 'Transaction Active' TXT file exist?

3) If 'Transaction Active' TXT file exists give operator choice of continuing or resetting. If Continuing go to #5.

4) Write 'NEW Transaction' TXT file.

5) Loop with line items.

6) Finish Transaction.

7) Update tables.

8) Delete Transaction TXT file.

9) Go to #1

You'll need to embellish this a little and you can certainly use other types of semaphore methods but this one is simple and straightforward. Add to this VFP's Transactional capabilities, a good UPS, hardware components & design and you'll have this licked..

Years ago, when I helped automate a retail craft store (read 65,000+ items in 1987) we also have a duplicate PLU (Price Look Up) table on half of the computer-based cash registers. That way if the network went down all that was needed was a quick reboot and the data was stored locally until a reconnect.

The absolute primary thought process should be redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy redundancy.

< BG >

HTH
Best,


DD

A man is no fool who gives up that which he cannot keep for that which he cannot lose.
Everything I don't understand must be easy!
The difficulty of any task is measured by the capacity of the agent performing the work.
Previous
Reply
Map
View

Click here to load this message in the networking platform