soci: "foreign_keys" does not work (SQLite)
When opening a database with foreign keys enabled via the connection string, actually the feature is not enabled.
soci::session sql(soci::sqlite3, "db=/home/matheus/.local/share/argo/argo.db foreign_keys=true");
std::int32_t a = -1;
sql << "PRAGMA foreign_keys", soci::into(a);
std::cout << a << std::endl;
The output is 0.
When executing the query sql << "PRAGMA foreign_keys=true manually, the output is 1.
I already check the source code and the test and do not know why it does not work.
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 18 (18 by maintainers)
4.0.3 doesn’t have foreign_keys, it is only on master
Your second test is exactly the same thing as I do above and I’ve tried adding
=to the connection string and it didn’t change anything (which is arguably a bug, it should have resulted in an exception…), so I still can’t reproduce it and have no idea what could be going on here.@Spixmaster Do you have a SSCCE?
I’ve written and run the following:
and it outputs
as expected here.