SQLite3 中的外键支持

发布于 2024-11-14 18:23:16 字数 256 浏览 2 评论 0原文

根据 2010 年的线程,“EnforceFKConstraints”连接字符串属性是应该会在 SQLite 的未来版本中实现。有谁知道开发商是否已经开始这样做了?

如果没有,是否有另一种方法可以启用外键支持,而无需在每个连接上执行“PRAGMAforeign_keys = ON”?我需要这个来确保删除总是级联。

According to this thread from 2010, an "EnforceFKConstraints" connection string property was supposed to be implemented into future releases of SQLite. Does anyone know if the developers have gotten around to doing that?

If not, is there another way I can enable foreign key support without doing "PRAGMA foreign_keys = ON" on each connection? I need this to make sure that deletes always cascade.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相思碎 2024-11-21 18:23:16

SQLite 的 System.Data.SQLite ADO.NET 提供程序的未来开发由该小组完成。该项目目前处于迁移状态,有些功能甚至现在不可用(1.0.66版本中可用,该版本最后由Robert Simpson维护) a>(原始库作者))。

根据 trunk 中提供的最新源代码,不支持“EnforceFKConstraints”。但是,有一个外键连接字符串属性,其默认值为False,也许它可以完成这项工作?尝试在连接字符串中包含 foreign keys=True 属性。请务必使用此处的最新稳定版本。

更新。深入查看源代码后,我几乎可以肯定此连接字符串属性完全符合您的要求。

Future development of System.Data.SQLite ADO.NET provider for SQLite is done by this group. The project is currently in migration status and some features are even unavailable now (which were available in 1.0.66 version, which is last maintained by Robert Simpson (original library author)).

According to latest source code available in trunk "EnforceFKConstraints" is not supported. However there is foreign keys connection string property which have default value of False, maybe it does the job? Try including foreign keys=True property in your connection string. Be sure to use latest stable build from here.

Update. After looking deeper in source, I'm almost sure that this connection string property is doing exactly that you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文