我想确保 iOS 4.0 中包含的 SQLite 库支持 foreign key constraints .官方文档声明:
In order to use foreign key constraints in SQLite, the library must be compiled with neither SQLITE_OMIT_FOREIGN_KEY or SQLITE_OMIT_TRIGGER defined.
如何在 C 中或使用 sqlite3
CLI 工具以编程方式检查它?
提前致谢。
最佳答案
文档说:
sqlite> PRAGMA foreign_keys;
0
sqlite> PRAGMA foreign_keys = ON;
sqlite> PRAGMA foreign_keys;
1
sqlite> PRAGMA foreign_keys = OFF;
sqlite> PRAGMA foreign_keys;
0
Tip: If the command "PRAGMA foreign_keys" returns no data instead of a single row containing "0" or "1", then the version of SQLite you are using does not support foreign keys (either because it is older than 3.6.19 or because it was compiled with SQLITE_OMIT_FOREIGN_KEY or SQLITE_OMIT_TRIGGER defined).
关于ios - 如何检查特定版本的 SQLite 支持哪些功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9229180/