Solved SQLite and PRAGMA
-
Hi,
I have a little problem with SQLite and PRAGMA.
In the main after the database connection I set the PRAGMA foreign_keys to ON. If I do a request just after the value is at '1'.But in another class if I do the same request, foreign_keys is at '0'.
I do a QSqlQuery q(QSqlDatabase::database()) so it's the same connection than in the main so I don't understand what is the problem.
I must do the "PRAGMA foreign_keys=ON" at each request ? The value in not keep for the connection ?Thanks for your help
Chocard -
Hi
did You try with no
a QSqlQuery q(QSqlDatabase::database())
as it normally uses the default connection when no db is given.
a QSqlQuery q; -
Thank mrjj.
After remove 'QSqlDatabase::database()' I find the problem (the database was close in other function).