Android Room Persistence Library: Upsert

前端 未结 9 614
太阳男子
太阳男子 2020-12-12 10:50

Android\'s Room persistence library graciously includes the @Insert and @Update annotations that work for objects or collections. I however have a use case (push notificatio

9条回答
  •  自闭症患者
    2020-12-12 11:31

    Should be possible with this sort of statement:

    INSERT INTO table_name (a, b) VALUES (1, 2) ON CONFLICT UPDATE SET a = 1, b = 2
    

提交回复
热议问题