Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ODBC in pessimistic mode
Message
De
03/11/1997 17:23:11
 
 
À
03/11/1997 15:57:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00057793
Message ID:
00058058
Vues:
33
>Ok, this is the technique we are focusing on. But, there is a problem with that. How can we be sure that 2 persons won't attempt to lock it at the same time? This is where a RLOCK() similar way of doing things is needed. Also, in our case, we will have different backends. In addition to finding a secure way of making sure not 2 persons get the record at the same time, we also need a mecanism that will work for all.
>
>Thanks.

If the lock column is called lock_user and it will accept NULLs than use a SQL UPDATE that looks something like this:

UPDATE table
SET lock_user = id
WHERE pk_column = pk_value
AND lock_user IS NULL

Only one person will be able to hit the row (or page depending on the database).

Then check the effected-row count or check the lock_user column to see if you got the lock.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform