Synchronizing an SQLite client database with a MySQL server database

前端 未结 6 1732
遇见更好的自我
遇见更好的自我 2020-12-01 01:35

I have created an app in xcode with sqlite3.I want to create a button named sync to sync with my mysql database in my server. Any suggestion about sync process? Please let m

6条回答
  •  温柔的废话
    2020-12-01 02:30

    I believe you are saying that you have a MySql Server running on one computer and you are running an app with a sqlite instance and you want to update the sqlite server if there is new data on the MySql Server.

    I would do it this way

    1) Make sure both the table on your computer and on the app have the same structure. Include a last updated field

    2) To check who is most up to date get the last row by your unique key and then compare the updated field.

    3) When the most up to date field belongs to the server then figure out how many rows are different and start copying them in a do ... while() loop or however you prefer.

    If you implement this code on both the server and on the client then they can update each other or if you prefer only update the client.

    The specifics are dependant on the language you want to use and the amount of time you wish to put into development.

提交回复
热议问题