My android app database syncs with a central database on my web server. My problem is efficiently syncing it.
The table is set up as “id” (primary key), “town”.
The android app wants all the ids of the people in a given town
My current process is:
get list of all ids for town "A"
set all existing records in Android database to "old"
add/update ids in the list to "current"
delete any records still set as "old"
The bottle neck comes in the add/update process which is:
for each id {
result = update WHERE _id = id
if (result == 0) {
add record
}
}
Is there a statement like WHERE _id IN(id1, id2, id3, id4 ….) that would act as add/update if already there??
Or am I going about it completely wrong?
Thanks
then why you updating the data, at the time of synch cant you delete all the data in android device and add the latest data from the server
i am saying this because it will flexible, first delete all and insert all(latest ones)