SQLite3 中的外键支持
根据 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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 ofFalse
, maybe it does the job? Try includingforeign 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.