On Mar 2, 2016, at 6:00 PM, Simon Slavin <slavins at bigfraud.org> wrote: > > On 2 Mar 2016, at 1:48pm, Itxaso Perez <iperezmuruaga at gmail.com> wrote: > >> - How can I 'execute' the DB-Jounal file just to try to 'correct' the >> database before execting NHibernate? > > Having a journal file on disk should not crash your app.
It is possible that NHibernate?s SQLite driver is calling sqlite3_config(SQLITE_CONFIG_LOG, ?) in order to catch SQLite errors. This works since most calls to sqlite3_log() signal some kind of error, so it is easy to think of the log message callback as an error handler. But, there are a few things that SQLite reports via this mechanism such as SQLITE_NOTICE_RECOVER_ROLLBACK and SQLITE_NOTICE_RECOVER_WAL, which are not errors, just FYI notices. They should not kill the program. Another odd case is SQLITE_ERROR with the log string containing ?syntax error?, which happens when your SQL is incorrect. I log that without exiting in my programs because it just turns into an empty result set, which my program can cope with. Thus, I?d rather have the program continue running instead of immediately dying. (I wish there were a SQLITE_SYNTAX_ERROR constant to separate this case out.)