Enable SQLite shared cache mode.

This allows all threads accessing the same database to share sqlite
objects. This, for example, fixes the issue with several threads
simultaneously writing to the same database file.

See https://www.sqlite.org/sharedcache.html

Addresses BIT-1325
This commit is contained in:
Johanna Amann 2016-07-21 12:08:57 -07:00
parent 697b59cdc8
commit 4968a5c654
4 changed files with 112 additions and 0 deletions

View file

@ -75,6 +75,9 @@ bool SQLite::DoInit(const ReaderInfo& info, int arg_num_fields, const threading:
return false;
}
// Allow connections to same DB to use single data/schema cache. Also allows simultaneous writes to one file.
sqlite3_enable_shared_cache(1);
if ( Info().mode != MODE_MANUAL )
{
Error("SQLite only supports manual reading mode.");