I have an application that syncs with a web server. When I update I want the row ID’s to match with the ones in the web server, because other data depends on correct mapping of row ID’s. I have thought of just clearing the table each time, but I don’t think that is a efficient way especially when the data gets very large. What is an efficient method for this?
Share
I’ll make it easy for you:
1) Add an extra column to your android db table, lets call it web server id.
2) When you first create the android table, insert the web server row id into this column.
3) Whenever you synch with the server, use that id to find the proper web server row to synch with.
This is all Database 101 stuff. You should really read up on foreign keys. It is clear the relationship is preserved even when data is changed, unless you are changing the key fields. However, the key fields should never be altered so the relationship will always be preserved.