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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

F/Rlock() with TableUpdate() 1

Status
Not open for further replies.

benasumwa

Programmer
Oct 14, 2003
57
KE

Hi Friends,

Still using VFP6.

My question is: With the application of appropriate buffering
combined with the TRANSACTIONs, is there any need to issue an explicit RLOCK() or FLOCK() or it's advisable to leave them out utterly?

Any suggestions will be highly appreciated

Time is the father of truth. Time will tell.
-------------------------------------------
Benson O. A. (Infinity Link Limited)
 

Hi Benson,

You should omit all explicit calls to FLOCK() and RLOCK() if you are using buffering. Buffering manages its own locks.

Not only that, but issuing explicit locks with buffering could cause unwanted side effects. In some circumstances, doing so will flush the buffer, which might not be what you expect.

However, be aware that buffering provides two distinct forms of locking: optimistic and pessimistic. Broadly speaking, FLOCK() and RLOCK() provide pessimistic locking, so you'll probably want to set the buffer mode to one of the pessimistic settings. If you make it optimistic, you'll have to do some extra programming to deal with possible multi-user collisions.

Hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
You should not be using a Transaction to resolve record-locking issues. A Transaction is for situations where you need to guarantee that either all or none of a set of related operations will execute to completion.

The TABLEUPDATE() and TABLEREVERT() functions in VFP let you program for multi-user access in Visual FoxPro.

Geoff Franklin
 
Mike Lewis,

Thanks mike. My situation warrants the optimistic table buffering option. I have indeed written a routine to handle
clashes on the network but needed confirmation as whether
R/FLOCK would be desirable.

Not only that, but issuing explicit locks with buffering could cause unwanted side effects

I did not know! I have learnt some new thing! Thanks Mike!

Geoff,

You should not be using a Transaction to resolve record-locking issues

Thanks for your concern. However, I only highlighted the TRANSACTION issue to give the whole picture as to what I am doing.

Guys, I am very thankful for mosthelpful hints

Time is the father of truth. Time will tell.
-------------------------------------------
Benson O. A. (Infinity Link Limited)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top