I found this article on synchronization:
http://www.databasejournal.com/features/sybase/article.php/3769756/The-Missing-Sync.htm
It is not included in the technical details, but you can guess what coding will implement these strategies.
I also don't have trendy notifications from my server, so I need synchronization strategies.
For example, I have a list of companies in my modelLocator. It does not change very often, it is not large enough to consider pagination, I do not want to reload it (removeAll ()) for each user action, but still I do not want my application to crash or update corrupted data if it was UPDATED or removed from another application instance.
What I am doing now is storing a SELECT datetime SESSION. When I return to update the data, I select WHERE last_modified> $ SESSION ['lastLoad']
This way I only get rows changed after loading the data (most of the time, 0 rows).
Obviously, you need to UPDATE last_modified for each INSERT and UPDATE.
For DELETE, this is more complicated. As the guy noted in his article: “How can we send a post that no longer exists”
You need to tell flex which item it should remove (for example, by identifier) so that you cannot DELETE DELETE :)
When a user deletes a company, you do an UPDATE instead: deleted = 1 Then in the updated companies, for the line where deleted = 1, you simply send the identifier back to flex so that it assures that that company is no longer in the model.
And last but not least, you need to write a function that clears the lines where deleted = 1 and last_modified are older than ... 3 days or whatever you think is necessary.
It’s good that if the user mistakenly deletes a row, he is still in the database, and you can save it from the real deletion for 3 days.