开发者

Database synchronization Server to Local

开发者 https://www.devze.com 2023-03-29 11:48 出处:网络
I have a local app that uses SQLite. Whenever it has internet access it requests the whole database from the server and recreates the local one from that. Local and Server databases have the same stru

I have a local app that uses SQLite. Whenever it has internet access it requests the whole database from the server and recreates the local one from that. Local and Server databases have the same structure, basically the point of the local one is to guarantee function even when no internet is available.

This is a very inefficient way of doing this. My question is, how to ask for only data开发者_开发知识库 that is missing?

Should I send the last ID from each local table and have the server send data from that ID onward? What happens if an existing ID was modified? This would mean that all data should be checked, but sending the whole database for checking and getting back the modifications or additions also seems stupid.

The configuration is Local SQLite, Server MySQL. I could probably change the server to SQLite if it's recommended.

EDIT:

Multiple clients make requests to the same server MySQL Database, PHP processes the request and replies.

How would you tackle this?

Thank you.


I'd either timestamp the rows in the database and fetch by date, or use rsync (or librsync or similar) to synchronize the database files.

0

精彩评论

暂无评论...
验证码 换一张
取 消