是否通过回滚事务来撤消 pragma 语句?
如果诸如 foreign_keys = OFF
和 VACUUM
之类的编译指示包含在回滚的事务中,是否会被撤消?文档似乎没有涵盖这一点。
Would pragmas such as foreign_keys = OFF
and VACUUM
be undone if included in a transaction which gets rolled back? The documentation doesn't seem to cover this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不同的编译指示语句是不同的。
SQLite 版本 3.7.15.2 在事务中包含 pragma
user_version
并将 COMMIT 和 ROLLBACK 该值。但是,它(在文档和测试中)从交易中排除了foreign_keys
。看来在事务期间未记录为无效的编译指示将参与事务。It is different for different pragma statements.
SQLite version 3.7.15.2 includes the pragma
user_version
in transactions and will COMMIT and ROLLBACK the value. However, it excludes (in documentation and testing)foreign_keys
from transactions. It appears that pragmas not documented as invalid during transactions will participate in a transaction.该文档不涵盖一般事务内发出的 pragma 语句会发生什么,但它确实涵盖了 的主题foreign_keys(可能也适用于其他):
VACUUM 不是一个编译指示,文档确实涵盖了事务:
The documentation does not cover what happens with pragma statements issued inside transactions in general, but it does cover the subject for foreign_keys (and possibly for others):
VACUUM is not a pragma, and the documentation does cover transactions:
我可以验证至少以下 PRAGMA 在事务中无效:
如果尝试,您将收到以下错误消息:
I can verify that at least the following PRAGMA is not valid within a transaction:
If attempted, you will receive some flavor of the following error message: