Reputation: 23200
I started using SQLite for my project and I found there are many libraries supporting it like Qt, pysqlite, Poco C++ etc. I also found out that previous SQLite versions didn't support foreign keys.
How do the drivers know what sqlite executable to use? And how do I know they support what version of sqlite they support?
Another question: How do I enable foreign keys in sqlite by default?
Upvotes: 1
Views: 346
Reputation: 5008
The answer is: it depends.
Some applications will use a statically linked sqlite, others will link dynamically against the .dll or .so (depending on your OS). And of the ones linking against the dynamic library, whether it uses a system-wide or application-folder version depends on the application.
I (thankfully) haven't seen any apps that go through the sqlite.exe.
Upvotes: 1
Reputation: 16657
SQLite manages the foreign keys, not the ad-hoc library. Each library (if they are half-decent) will have their documentation which will list what version of SQLite is supported.
To determine if foreign keys are turned on in SQLite:
PRAGMA foreign_keys;
To turn on foreign keys:
PRAGMA foreign_keys = ON;
EDIT: This must be turned on not only before database creation, but at every connection for SQLite to activate foreign keys and their magic. (This is because foreign keys are not legacy, but is expected to change).
Upvotes: 0