Android Room @Delete with parameters

后端 未结 3 1462
说谎
说谎 2020-12-15 02:21

I know I can\'t use DELETE in a query (that is a shame by the way), I will get the following error:

Error:error: Observable query retur         


        
3条回答
  •  执念已碎
    2020-12-15 02:51

    You can use below method to delete by ID

    @Query("DELETE FROM yourDB WHERE id = :id")
    void deleteById(int id);
    

    for delete all rows

    @Query("DELETE FROM yourDB")
    void delete();
    

提交回复
热议问题