1

I'm currently using SQLiteDatabase.replace to update certain rows in my database. I'm migrating to a ContentProvider and I'm trying to replace these statements with an equivalent ContentProviderOperation. There are factory methods for update, delete, and insert, but there's no newReplace. I'm guessing that's because the documentation says that SQLiteDatabase.replace is a convenience method which replaces the row only if the primary key matches, else it adds a new one. However, I don't understand what's actually going on under the hood. I assume if I just did a delete then insert it would be less efficient than a replace, is that correct?

How do I mimic the functionality of SQLiteDatabase.replace using ContentProviderOperation?

noisecapella
  • 814
  • 7
  • 17

1 Answers1

0

This looks promising (at least for my use case): Android Contentprovider - update within an insert method. Basically I need to change insert() in my ContentProvider to do an update if it fails.

Community
  • 1
  • 1
noisecapella
  • 814
  • 7
  • 17