[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kpeople] src: Set a name for the database connection
From:       Martin Klapetek <mklapetek () kde ! org>
Date:       2016-03-11 14:54:19
Message-ID: E1aeOSJ-0004sZ-Eh () scm ! kde ! org
[Download RAW message or body]

Git commit 2dec39f0c62a6279a558ab6a7ada830c5cc2a200 by Martin Klapetek.
Committed on 11/03/2016 at 14:54.
Pushed by mklapetek into branch 'master'.

Set a name for the database connection

If the app using KPeople is also using a QSqlDatabse and also
with a default connection name but different database, Qt will
reuse the connection and close one database and reopen the other,
which can cause troubles, especially then when used with QSqlQueryModel.

REVIEW: 127267

M  +1    -1    src/personmanager.cpp

http://commits.kde.org/kpeople/2dec39f0c62a6279a558ab6a7ada830c5cc2a200

diff --git a/src/personmanager.cpp b/src/personmanager.cpp
index 5c2d7af..5781536 100644
--- a/src/personmanager.cpp
+++ b/src/personmanager.cpp
@@ -61,7 +61,7 @@ Transaction::~Transaction()
 =

 PersonManager::PersonManager(const QString &databasePath, QObject *parent):
     QObject(parent),
-    m_db(QSqlDatabase::addDatabase(QStringLiteral("QSQLITE")))
+    m_db(QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), QStringLiter=
al("kpeoplePersonsManager")))
 {
     m_db.setDatabaseName(databasePath);
     if (!m_db.open()) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic