Closed richsmith92 closed 12 years ago
You could probably wrap it in "COMMIT; PRAGMA synchronous = OFF; BEGIN TRANSACTION"
Thanks. I have already switched to low-level "sqlite" package. But I'll try your solution if there will be opportunity. You can close the issue if you don't plan to add special functions for SQLite pragmas.
I'm also blocked with similar problem. Thererfore: Does it make sense to put pragmas feature only while connecting to DB? I think that foreign_keys enabling yes, but I'm not sure if this is generally proper solution. Alternative solution would require change of API (IConnection type class would need one more function) - IMHO. If this is true the first solution would be lightweight in comparison.
For the same reason like described in the ticket I was not able to run "PRAGMA foreign_keys = ON". The solution https://github.com/hdbc/hdbc-sqlite3/issues/6#issuecomment-1184186 solves my problem though, so my previous comment https://github.com/hdbc/hdbc-sqlite3/issues/6#issuecomment-3050835 can be forgotten.
When trying to run this code:
main = do conn <- connectSqlite3 "test.db" runRaw conn "PRAGMA synchronous = OFF"
I get this output:
TestDB.hs: SqlError {seState = "", seNativeError = 1, seErrorMsg = "prepare 25: PRAGMA synchronous = OFF: Safety level may not be changed inside a transaction"}
If I use the pragma in the autocommit sqlite3 console, all works right.