Briefcase and Synchro

Hi,
I have a DA Server made with Delphi, some local clients made with Delphi also.
On the other hand I have some IOS clients that will run out of network.
Delphi clients datas will always be up to date since they are connected locally.
For the IOS ones, it’s another story, users will add/edit/delete datas when they will use the iPads. I will use Briefcases for this case.
Will all stuff done in IOS client will be updated on server (including deleted rows) ? Same question for modifications made using delphi clients (local, no briefcase).
What I want is that whereever the datas modifications (add/edit/delete) were done, server and IOS clients are always updated, and only deltas are sent (huge database).
Is it trully the case if I use briefcase on IOS ?
Regards

Armindo

tech1yakicerocom said: Is it trully the case if I use briefcase on IOS ?
Yes sure.

You can think about briefcase as about local data cache on the client side.
In most cases, using the briefcase you can:
a) minimize traffic between the client and the server.
For example, if you have some stable reference data then there is no need to send it to the client application each time when it being started.
You can read it once and then store it in the local briefcase and then load it when you need it.
b) work with the data in “offline” mode without persistent connection to the server.
In this case you can write down your data with the changes to the briefcase and shut down your application.
Later, when you will be able to reach the server you can run your application again and apply the persisted changes back to the server.

Thanks Alex for your reply.
The problem with Briefcase is that you cannot use complex SQL queries with it, for this I will use SQLLite, and use the briefcase as cache. All my SQLite records have timestamp, so before synchro I can apply these change to the briefcase. If datas are deleted on briefcase or on server, will it be applyed on both side too (server and briefcase) ?

My idea is like that :

  • first time download all tables from server and save them to briefcases.
  • copy briefcases to SQLite tables.
    -work on SQLite.
    When have to do a synchro, I edit,add,delete record on briefcases (only those after a certain timestamp). then update server tables, and update briefcase from server. then apply change to SQLite. Note that tables on server use timestamp also.

But I’m not sure if briefcases manage deleted files.

Hi

When have to do a synchro, I edit,add,delete record on briefcases
(only those after a certain timestamp).
then update server tables, and update briefcase from server.
then apply change to SQLite.

not exactly. Briefcase plays as the local data storage that persists the data between application runs.So during your application start you can deserialize data from the briefcase to the DADataTable, then copy data from DADataTables to your custom SQLite tables.

And the most complex thing in this scenario will be keeping synchronization between your DADataTables (which holds your data and can generate deltas to update it on the server side) and SQLite tables (where you want to do all modifications).
You will need to transfer any changes you’ve made in the SQLite tables to the DADataTables to be able to form the delta object and send it to server for update.

Later when you will need to close application you can write all your data from DADataTables back to the briefcase

But I’m not sure if briefcases manage deleted files.

Please note that you cannot remove certain row from the briefcase directly. Actually briefcase is just the set of serialized DADataTables. So you can read tables from briefcase in exactly the same state as you previously wrote them there

What happens when the schema changes on the remote DA server? Will the local Briefcase still be able to synchronise even after the schema changes? How are database updates handled within the briefcase model?

i would suggest treating the briefcase/DADataTable as the local truth. only copy stuff over into SQLite so you can query it there, if necessary, don’t edit data in SQLite, nor try to sync back.

Also, what kind of SQL queries do you need that you really cant express as NSPredicates on DADataTable? NSPredicate is crazy powerful.