Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking methods

Status
Not open for further replies.

HUNzsolt

Programmer
Dec 5, 2005
3
HU
Hi All!
Anyone knows how Clipper's locking system works? I need some info on the index files' locking method. I figured out, maybe there is an offset of 0xFFFFFFFF minus a number between 0-65535, and the result byte is locked. I need to find out, what this number is...
Thanks!
-=ZS=-
 
Whooops, I forgot this:
Maybe Clipper locks ALWAYS the whole index file, not only records, or pages of it?
 
By default Clipper locks whole database, unless you specify:
SET EXCLUSIVE OFF
in this case you should take care about locking. In my expirience, locking is done by operating system rather than clipper, at least in S87'. Clipper only instructs OPSYS to lock the record.
There are two methods, that are to consider: agressive locking goes like this:

Seek(whatever the key is)
RLOCK (or better a function that attempts the lock and recover if lock is not succesful)
DO THE GETS
if lastkey() <> 27
replace .....
endif
unlock or commit

nonagressive goes like this:

Seek(whatever the key is)
DO THE GETS
if lastkey() <> 27
RLOCK
REPLACE
unlock or commit
else
report the error
endif
 
Locking is dependent on Clipper version _and_ RDD used. Each RDD uses it's own scheme, and between Clipper 5.2 and 5.3 the DBFCDX driver even was replaced with a sort-of 'COMIX-lite' wich has a slightly different locking schema. More details are to be found in the sources of xHarbour' DBFCDX driver if you have to, as Przemek did (obviously) a lot of research, and managed to get it all quite right, AFAIK.

HTH
TonHu
 
Thanks for the comments!

I'm using 5.3 with DBFCDX, and with an other application, found out which bytes are locked, but i don't know why those. The bytes are from 0xFFFeFFFF to 0xFFFFFFFF in every case, even with an empty index or with an 50MB-index...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top