Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 sqlite 在我的应用程序中存储数据。数据被正确存储(我可以在数据库中看到它)并且被正确提取。
然而,大约一天后,当我回到我的应用程序时,数据库丢失了一些数据。我已经进行了调试以验证正在显示的内容是存储在数据库中的内容。有谁知道发生这种情况的任何示例或场景?为什么会发生,我能做些什么来阻止它发生?
谢谢
听起来好像您可能正在开始交易,而不是完成交易。管理事务的正确方法是:
db.beginTransaction(); try { // insert data here db.setTransactionSuccessful(); } finally { db.endTransaction(); }