Author
Topic: General guideline for briefcase model (Read 1376 times)

I'm writing a program that operates on a subset of DB records from Firebird DB. I have to consider situation where the subset of records and final DB are connected remotely, e.g. through web-service.

I know that I can use TBufDataset in Lazarus. First I download a subset of records, make a temporary TBufDataSet locally, users modify the local copy, and then send it back. At server side, for insert or update, "update or insert" SQL statement based on primary key is good enough. But for deleting, I have to keep track of deleted records at the terminal side. So, currently if the size of subset is large, I delete all the records in server DB, and then insert all the records from terminal. If the size of subset is small, I delete / insert / update the server-side record as soon as the local record is modified.

My question is: Are there 1) better method that I don't know, or 2) any general rule for this case, or 3) What are the best approaches based on your experiences?

A briefcase model is just what it says: it retrieves a state (some records) and you can work locally with it. Subsequently you will need to post the changes to the server and resolve any conflicts and retrieve the new state *from the server/at the server side*. That is by definition. There's no way around that. (pure logic)