Home | Web Design | Programming | Fairlight CMI | Soap Box | Downloads | Links | Biography | About... | Site Map |
Data Locking |
CA-Clipper | Opportunities | Tips and Tricks | Networking | Internal Errors | Source Code | CA-VO |
BACK TO CA-CLIPPER NETWORKING |
DBF files
In CA-Clipper, data in tables is locked internally by logical semaphores. DOS locks (5Ch) are not applied to the record data itself, but to a single byte somewhere beyond the actual end of the file. This use of semaphores allows other users to "read through" the locks, because the actual record data is not locked. Foxbase uses a similar technique, but dBase locks the byte range occupied by the record data. The difference in locking algorithms is yet another reason why programs written in the different languages cannot access the same tables at the same time. They do not see each other's locks. dBase III+ record locking formula: Starting byte: [32 + fcount()*32] + (recno()-1)*recsize() Bytes-to-lock: recsize() Clipper record locking formula: Starting byte: 1,000,000,000 + recno() Bytes-to-lock: 1 Foxbase record locking formula: Starting byte: 2,147,483,647 + [32 + fcount()*32] + (recno()-1)*recsize() Bytes-to-lock: recsize() The value 2,147,483,647 is 80000000h or 2^31, which is half size of the largest DOS file. All three of these approaches have their problems. The dBase method locks the actual record data, which prevents other users from even reading the record. The CA-Clipper and Foxbase methods both have the limitation that if a file gets very large (greater than about 1 gigabyte for CA-Clipper and 2 gigabytes for Foxbase), the semaphores for the first few records may overlap the physical location of the last few records.
NTX files DOS locks are applied to the whole index file when read or written to. This is transparent, and beyond programmer control. Contention with other users is automatically arbitrated. The file is locked in the process of navigating, or restructuring the index, as done in the following processes: Navigating (reading) find , skip , count ,
seek , display all , index on ,
label form , list , report form ,
sum , total Restructuring (writing) replace DBT files DOS locks are applied to the whole DBT file when read or written to. This is transparent, and beyond programmer control. Contention with other users is automatically arbitrated. The file is locked in the process of extending the file, as done by the replace command.
|
Home | Web Design | Programming | Fairlight CMI | Soap Box | Downloads | Links | Biography | About... | Site Map |
Send comments about this site to Greg at
gregh@ghservices.com All pages copyright © 1996-1999 GH Services Created 1997/06/09 Last updated 1999/09/30 All trademarks contained herein are the property of their respective owners |