It's mostly only powr outages and network fails during writing, that cause table corruption.
And data-loss vs structural corruption is closely coupled, the structure of a dbf is mostly data only anyway.
The most frequent error in DBF is wrong reccount in the DBF header. There is an easy fix for that:
Code:
SET TABLEVALIDATE TO 0
USE Table
APPEND BLANK
DELETE
* PACK && optionally to get rid of the blank record.
USE
There is really nothing for CDXes, you better DELETE TAG ALL and redefine. Therefore you need info on the structure of tables and especially indexes. That's because the data section of index files are organised in a tree structure, not as simple as the records of the dbf, which merely are a simple list of recsize() blocks comparing to c/c++ structs stored to a file, pure data.
One thing mostly unknown or overlooked: If you think the easiest way to update data is to use dbfs unbuffered and think there are only few updates, you fail to see how often each single tabbing from one control to the next causes a write of a single field, perhaps even if the value did not change. The controlsource and the valid event is an automatism you have to know. And if you say: But I don't lock, so there is no reason for a conflict. The truth is there is no shared write access, so there are automatic locks at least, always. And many more without buffering.
Yes, there is SQL, especially SQL Server backends. Their main advantage is one central service instance accessing the data file(s), not a swarm of clients, any operation arrives as a request and the one service instance processes them one after another, also in parallel, but with the overview over requests pending and how to avoid resource conflicts.
Buffering your workareas and using transactions stabalize file health.
Note1: Buffers are not part of the DBF files, but of workareas, eg if you USE some.dbf AGAIN you have two buffers for the same DBF. And also of course in different data sessions and at different clients. The downside of that is there is no central current state of a DBF or a record in it.
Note2: Transactions add further locking of the files for access of groups of tables, eg a child/parent hierarchy, but add to your responsibility for checking success, solving conflicts, not resource or lock conflicts, rather inconsistent writes, eg a delete and an update, or two updates to value1 and value2. Without buffering and transactions these could even happen undetected, with some random winner. In that respect often unbuffered non transactional write work quite good, as long as there is low traffic to the DBFs
Bye, Olaf.