Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ODBC in pessimistic mode
Message
De
04/11/1997 07:55:13
 
 
À
03/11/1997 17:23:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00057793
Message ID:
00058119
Vues:
34
>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

This is exactly what I do. I put it in a stored procedure on the backend (for performance), but there's no reason why you can't use a VFP Procedure. Your backend server should resolve any conflict between two users trying to UPDATE at the same time.

I would also modify the UPDATE a bit:
UPDATE table
SET lock_user = id
WHERE pk_column = pk_value
AND lock_user IS NULL OR lockuser = id

HTH
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform