Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How Cursoradapter handle pessimistic locking
Message
De
09/12/2004 04:37:37
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
08/12/2004 22:02:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
00967922
Message ID:
00967954
Vues:
14
>Did anyone know how it work ?
>
>Thank you and good day

CA doesn't handle pessimistic lock. However on any backend you can implement your custom pessimistic locking strategy. Using stored procedures you could create LockRecord(),ReleaseLock() procedures.

-A session starts and creates a GUID to identify the session uniquely. Say oApp.InstanceID.
-Calls lockrecord(oApp.InstanceID, tableName, PK(s)ToLock)
A table with a structure like:
cTableName, PK, cLockedBy, tLockedOn, noMax (to force unlimited lock)
holds locking information database wide. LockRecord() can 'lock' a record if:
Not in locked list or Locking duration is over an allowed maximum or the lock requester is the same as cLockedBy.
Returns back the passed instanceID as an indicator of success or recorded instanceID as an indicator of failure + 'who locked info'. So it looks like:
lcLockedBy = lockrecord(oApp.InstanceID, tableName, PK(s)ToLock)
if ( oApp.InstanceID == m.lcLockedBy ) && Success
-ReleaseLock() complements it to unlock acquired lock(s) unconditionally
-A third component is wise to have as a 'watchdog' to signal the lockers and if they're dead unlock.

While it's doable this way it's rare an app really needs pessimistic locking and not worth the complexity of coding.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform