何时关闭 SQLite 数据库(使用 FMDB) [英] When to close SQLite database (using FMDB)

查看:49
本文介绍了何时关闭 SQLite 数据库(使用 FMDB)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

何时应该关闭与 SQLite 数据库的连接(在 FMDB 中使用 [db close])?

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?

谢谢

推荐答案

我是编写 FMDB 的人.

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.

这篇关于何时关闭 SQLite 数据库(使用 FMDB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆