Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to handle Record Lock in C/S apps?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00571574
Message ID:
00571587
Vues:
23
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform