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

@ -120,6 +120,9 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields,
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);
num_fields = arg_num_fields;
fields = arg_fields;