Android Question Update database in app and server

yfleury

Active Member
Licensed User
Longtime User
I have sqlite in app and a Mysql via jrdc2 serveur at home.
Each row on all table have a time(unix) Each time a row is update, the time is update too.
Many devices running my app use same data
Each time a device run the app, I want to restore data from serveur with the latest data and keep in app the latest data from app.
When user close the app. I have to backup data in app to server with uptodate

How to keep the latest data on sqlite in app and mysql serveur? Any clues?
 

TILogistic

Expert
Licensed User
Longtime User

tips:

Check the process logic of these examples.


 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Thanks @oparra

Just to be sure I understand well. KVS cant take all my database (if I want) and put it in mysql database and vice and versa. Then overwrite my data on serveur even if data is yonger than app data. Is it right?

Just to be clear for my request.
I want to have the most update data on both side (my app database and server Jrdc2 mysql database)
To help, each row have a field filled with datetime.now when it update in app database
if a row in app data is most recent than row in mysql (jrdc2 server) then I update it on server
if a row on server is most recent than row in app data then i update row in app data.
 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Finaly I make a subroutine for each table of app database

I load server table in list (custum Type)
I compare each row of app table and type in list for difference.
Then I make an update, insert (for new row) in app table. Then a table in app is up to date.
To be sure the server table have all data (if a new row in app table). I delete all row in server table and insert all row of app table. The a table on server is up to date.

I think that be ok.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…