什么时候在sqlite上使用pragma?

什么时候使用pragma?

数据库是第一次创建还是在每次连接数据库时?

这取决于使用的pragma.从 The definitive guide to SQLite,Database Configuration

Many pragmas have both temporary and permanent forms. Temporary forms affect only the current session for the duration of its lifetime. The permanent forms are stored in the database and affect every session.

或者,用你的问题的话来说:临时表格用于与数据库的每个连接,在第一次创建数据库时使用永久表格.

pragma documentation没有明确指定pragma是临时的还是永久的.然而,它通常会说类似的东西

auto-vacuuming must be turned on before any tables are created. It is not possible to enable or disable auto-vacuum after a table has been created.

意思是auto_vacuum是一个永久的pragma,或者

When you change the cache size using the cache_size pragma,the change only endures for the current session.

表示cache_size是临时的.

所以你最好回答你的问题是仔细阅读你特定的pragma文档.或者,您可以学习pragma source code(搜索** PRAGMA [,区分大小写).

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能