When to close SQLite database (using FMDB)

徘徊边缘 提交于 2019-12-18 16:51:09

问题


When should you close the connection to an SQLite database (using [db close] in FMDB)?

Right now I am closing it after running every batch of related queries, but should I rather close when my app closes? What are the pros/cons of doing either way?

Thanks


回答1:


I'm the guy who wrote FMDB.

Keep it open unless you change your schema. That's the only reason to close it, and constantly re-opening it is a little hit on performance / battery life.



来源:https://stackoverflow.com/questions/15720272/when-to-close-sqlite-database-using-fmdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!