summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/sqlite
diff options
context:
space:
mode:
authorEric Lemanissier <eric.lemanissier@gmail.com>2017-02-16 11:12:31 +0100
committerEric Lemanissier <eric.lemanissier@gmail.com>2017-03-25 06:18:07 +0000
commit610a9e8f319eafcbcf193e4b90119a6f89d0caf9 (patch)
treef3e95ba23dfb16629e6af2e5018682106f2abd21 /src/plugins/sqldrivers/sqlite
parent8092a01f84b1ddbffe8d2410db37931f3a71c83a (diff)
SQLite: Disable mutex on connections
By default SQLite opens DB in Serialized mode, allowing connections to be used from several threads simultaneously: https://www.sqlite.org/threadsafe.html According to Qt documentation, database can only be used from one thread. This change opens sqlite dabases in "Multi-thread" mode, so that one does not pay for useless mutex locking for each DB access Change-Id: Ife61f1a648d74c91d3b27a2ce0059d052ccc62b2 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/sqldrivers/sqlite')
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index c2feaeea56..8f336fd173 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -700,6 +700,8 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
if (openUriOption)
openMode |= SQLITE_OPEN_URI;
+ openMode |= SQLITE_OPEN_NOMUTEX;
+
if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) {
sqlite3_busy_timeout(d->access, timeOut);
setOpen(true);