微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

什么时候在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 [,区分大小写).

原文地址:https://www.jb51.cc/sqlite/197670.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐