Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conflict management in views
Message
De
12/11/2004 13:08:27
 
 
À
12/11/2004 11:04:41
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00960857
Message ID:
00960939
Vues:
21
Hello,

on MS-SQL Server you can use "Key Field & Timestamp"
which is IMHO the best conflict check method (no long SQL statement - very fast)

if you use other DB backends you can code a special CursorAdapter class that uses the same concept (isn't that much effort)

i don't have coded a field based conflict checking system yet since it's really much work for very little value, for me this scheme was ok (pseudocode)

IF !TABLEUPDATE(.t.,.f.,'someview')
MESSSAGEBOX('Another user has changed the record .. the record is now reloaded .. !')
TABLEREVERT('someview')
REFRESH('someview')
RETURN
ELSE
.. code to set form to non-editing status ..
ENDIF

a complete another approch would be to use a hand coded pessimistic locking scheme e.g.

user wants to edit a record:
-Rlock a special "editing table" which holds info which records are currently edited
-lockup key in "editing table", if not found add it .. else display user that the record is being changed by another user (it's also easy to display which user is working on the record - just add another field in the "editing table"), after that UNLOCK the "editing table" again so other users can use it ..(locking the "editing table" ensures the validity of the whole process, so no 2 users can get editing access to the same record)
-if lock was granted REQUERY the view so you have the latest data from the server for sure
-when user saves changes .. remove the entry from the "editing table"

with this scheme you don't ever have to handle conflicts cause they are excluded

drawbacks of this approach is that the locking table could be a bottleneck if the system has very much users

Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform