I create my applications using Optimistic concurrency control , without blocking any record when the user wants to edit it or try to control concurrency.
Important calculations and updates are performed on the server side (application or database) after installing the built-in database locking function when processing updates used by the client. Automatic DataSnap transaction rollback prevents these locks to block other concurrent users in the event of a failure.
In DataSnap, you have full control to prevent data loss when two user conflicts collide using the appropriate ProviderFlags fields for your fields. Set pfInWhere for any field that you want to check automatically to have the same value at the time of release / deletion as when reading a record.
In addition, in a collision, you can program the program on the application server (OnUpdateError event of the provider), on the client (TClientDataSet OnReconcileError event), or even ask the user about the correct resolution of conflicts (look at ReconcileErrorDialog in the New Item Repository).
At the same time, IMHO avoids the complexity necessary to maintain lock lists, client lists, lock lists for each client, activity messages, reliable recovery of application server failure and all possible failures that you will end with a cleaner and the best solution.
jachguate
source share