Recent

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

egsuh

  • Hero Member
  • *****
  • Posts: 1273
General guideline for briefcase model
« on: May 18, 2018, 12:59:51 pm »
Hi,

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?

Many thanks in advance.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: General guideline for briefcase model
« Reply #1 on: May 18, 2018, 01:08:10 pm »
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)
« Last Edit: May 18, 2018, 01:10:51 pm by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018