0

I have a relatively small Table in a SQL database in my Android app (around 15 or 20 rows). Every so often I want to be able to do a complete re-sync of the database with an online JSON file, so that:

  • Rows in the JSON file that are not in the database are added
  • Rows in the JSON file and in the database are updated
  • Rows in the database that are not in the JSON file are deleted

What's the best way to do something like this?

1 Answer 1

1

1 & 2 are quite easy, use Insert or Replace statement. The third one there's no real easy way to do that short of getting all the id's from the database then removing all the id's from the json file, then running deletes on the id's you have left.

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

Comments

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.