Skip to content

Concurrency Control #785

@duncangroenewald

Description

@duncangroenewald

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.

  1. Fetch record (with timestamp)
  2. Modify field
  3. Save record (update record set field=xxx WHERE id=ID AND tstamp=fetchedtstamp)
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions