A scheme I've seen used in other systems is to insert a dummy entry for the key, having it rejected if it's a duplicate. Ignore errors from that operation and then update by key.
Depends on the specifics of the DB as to whether that will be more or less efficient than doing a query first. On Oct 17, 12:10 am, "Hendrik Greving" <fourhend...@gmail.com> wrote: > I'd like to have a sqlite table with rows of 4 entries: a row id, a string > and 2 integers and possibly more data later. I want the string to be unique. > What's the easiest way to write an adapter that insert new rows with > automatically replacing if the string already exists? Does > DatabaseUtils.InsertHelper help? What is this for actually? How can I use > CONFLICT_REPLACE? I could probably get it working by making a query and then > delete and inserting or something like that, but I'm sure there is a better > way. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en