0

I have an SQLite database for my Android app that stores a copy of some data from another database on a server. When the user opens the app, I want to sync the local copy to the external master. The user may have been on the related website and inserted/updated/deleted data.

If it was just insert/update, timestamps could be used, but as they could delete data, I'm not sure how to go about checking for deleted rows.

So, what's the best way to tell what's changed and update the local copy?

2
  • 1
    What about another column with a flag... new, deleted, no change... Commented Aug 5, 2011 at 9:34
  • Thanks for all the suggestions everyone! I have a plan now :) Commented Aug 5, 2011 at 16:39

2 Answers 2

2

I'd add a table to audit the deletes (containing key fields of the deleted records) and transfer that on sync, and after a successful sync clear the table down.

Sign up to request clarification or add additional context in comments.

Comments

0

Hm, we are working on iOS project, which will sync it's database with server if server will respond what it have newer version. Our server incrementally stores performed SQL and on request if compounds all those changes to specific date and gziped sends to the application, where my Objective-C wrapper execute SQL statement from downloaded file.

May be same approach will be good for you too.

1 Comment

A colleague also suggested a similar approach - I think this is the way I'm going to do it. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.