#1 2020-08-26 20:28:21

leus
Member
Registered: 2012-09-05
Posts: 79

Offline records?

I'm writing a smallish application that will work with some existing project.

Currently, my main application uses a MySQL database, and it's an old-fashion client-server architecture. I'm using Delphi and AnyDAC in this application. This is an invoicing app.

Now, I'm in the process to create a small client application that will create legal electronic receipts, and save them in the existing database. My initial design is a *new* mORMot server application that will act as a proxy between the existing MySQL database and this new client. This is going well for the most part, but I have one problem: this client application sometimes will need to work *without* connectivity. I'm thinking of having a local storage (using SQLite3) and, when connectivity is available, push any records to the server.

Now, the question: is there a way to do this with automagically with mORMot, or is this something that need to implemented in a custom way, for example, a column in the database?

Offline

#2 2020-08-27 06:08:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,603
Website

Re: Offline records?

You can indeed have a local storage and put the data back to the server once connected.
This is IMHO the easiest part - and for a few receipts, I wouldn't use a SQlite3 engine - not needed - but just a TSQLRestServerFullMemory with binary serialization.

Or you can use ORM master/slave replication and use the server as slave database.
See the documentation about ORM replication.

Both ways are not fully magic. They need to put some code and logic.

Offline

#3 2020-08-28 12:16:41

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Offline records?

ab wrote:

Or you can use ORM master/slave replication and use the server as slave database.

What happens if the master server is down during the process of syncing? Can it persist the pending data and restart the syncing?

PS, I remember I posted a similar reply yesterday but somehow it disappeared...


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2020-08-28 16:44:17

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,603
Website

Re: Offline records?

This is the other way around: the master is a client, and the slave is a server, in terms of HTTP.

Check the docs and the diagrams again.

Offline

#5 2020-08-28 17:25:48

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Offline records?

@ab,
I know, but I'm not discussing the OP's question, but my question is about the general master/slave replication feature of mORMot.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#6 2020-08-28 17:51:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,603
Website

Re: Offline records?

IIRC the synch is done until it it acknowledged.

Offline

Board footer

Powered by FluxBB