storio icon indicating copy to clipboard operation
storio copied to clipboard

What's the best way to put or update in case of conflict?

Open saket opened this issue 7 years ago • 1 comments

Hello!

Apart from using DefaultStorIOSQLite#lowLevel()#insertWithOnConflict, is there any other way I can use DefaultStorIOSQLite#put() which falls back to update if a row with the same primary eky already exists?

saket avatar Dec 06 '16 14:12 saket

Yes, you can basically do whatever logic you want to do, ie query db to find "existent" row and update it or remove it and insert new one, up to you, just don't forget to put such logic into a transaction!

On 6 Dec 2016 5:20 pm, "Saket Narayan" [email protected] wrote:

Hello!

Apart from using DefaultStorIOSQLite#lowLevel()#insertWithOnConflict, is there any other way I can use DefaultStorIOSQLite#put() which falls back to update if a row with the same primary eky already exists?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pushtorefresh/storio/issues/728, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7B3LpaAsMcpaxhQGRaY0CeawvQFIYdks5rFW9IgaJpZM4LFdYa .

artem-zinnatullin avatar Dec 06 '16 15:12 artem-zinnatullin