Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to handle Record Lock in C/S apps?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00571574
Message ID:
00571587
Views:
25
The simplest way to handle this issue is through a semaphore locking scheme. Add a table to your database that holds the name of the table and the PK of the record you wish to lock. Then, create a 2 stored procedures: one to check to see if you can get a lock and the other to unlock. The lock proc simply checks to see if a record in the locktable already exists. If it does, the proc will return -1. If the record does not exist, the proc will add a record and will return 0. The unlock proc simply deletes the record from the lock table.

This scheme has some limitations. Most notably, if other apps write data to the database, they too will need to use the stored procs. This is why I suggest using stored procs as opposed to using Fox code to see if you can lock a record.



>If I'll be using RVs in manipulating SQL Data, how to lock a record so that it can not be edited by anyone and then release the lock afterwards to make it available for editing?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform