Add support for running commands before hardcoded pragmas
I can't reopen #1450, so posting it again:
I tried building this project with sqlcipher, but it fails because the pragma key = '...' needs to be the first command after opening the database (if it's encrypted of course).
The issue is that the SQLiteDriver.Open() issues various pragmas before letting the client code. This could either be fixed by adding support for a new _pragma_key parameter or adding support for running arbitrary pragmas before the first PRAGMA busy_timeout = %d; runs.
More context after your reply:
The key needs to be the very first query, even before busy timeout, otherwise it fails, hence why I opened this issue. I currently maintain a patch of this for an app where I use sqlcipher. If there was a way to inject a query (or specifically a pragma), I could make this lib work without having to maintain a patch.
Currently with sqlcipher it only works on unencrypted dbs. I even reproduced it manually in the sqlcipher cli - if you issue a busy timeout before the key, it errors.
The patch I mention is here: https://github.com/RikudouSage/FioClient/blob/master/patches/go-sqlite3-sqlcipher-overlay.patch
Though I'm not proposing to include it, something more generic would be fitting so that you don't lock yourself to supporting sqlcipher.
Source: mattn/go-sqlite3