-
-
Notifications
You must be signed in to change notification settings - Fork 178
Description
I am considering using Fluent for a client macOS application but need some form of concurrency control to make sure the user is not updating and overriding a newer copy of the record.
Typically this would be done using a TIMESTAMP property that gets updated by the database server when a record is updated. The client performing the update would need to perform the updated including the timestamp in the WHERE clause as explained below.
- Fetch record (with timestamp)
- Modify field
- Save record (update record set field=xxx WHERE id=ID AND tstamp=fetchedtstamp)
- Fetch the updated timestamp (updated by the server when the update is performed) and update the local model object so that any further updates have the correct timestamp
Is there any way to support this in Fluent currently ?
I don't believe the current Fluent @timestamp property is used to check that the record being updated in the database isn't a more recent version.
If another user modified the database record after the user has fetched the record then the update should fail and the model object should get the new version from the database.