Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.5
-
None
-
-
b1af52f2b2e1d318fc7a5481659e8101bf2e18dd (qt/qtbase/dev) 45194de004a090e0d68b8b117e0f4384919ed24a (qt/qtbase/5.15)
Description
Create a database connection:
auto db = QSqlDatabase::addDatabase("QPSQL"); db = QSqlDatabase::database(); db.setHostName(Settings::instance().dBHostname()); db.setUserName(Settings::instance().dBUserName()); db.setPassword(Settings::instance().dBPassword()); db.setDatabaseName(Settings::instance().database()); if(!db.isOpen() && !db.open()) { qWarning() << "Could not open database connection!"; return; } if(!db.driver()->subscribeToNotification(internmentsChangedNotificationString())) qDebug() << "Could not subscribe to notification" << internmentsChangedNotificationString(); else qDebug() << "Subscribed to notification" << db.driver()->subscribedToNotifications();
Start PGSQL server, start the application, everything is fine.
Now stop SQL server, wait some seconds, reopen it.
db.IsOpen() will return true, and if one tries to subscribe to the notification it will inform the user that it is already subscribed to it. But it isn't. Moreover it seems that db.isOpen() will reconnect against the database.
Attachments
For Gerrit Dashboard: QTBUG-84356 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
308688,2 | PostgreSQL: Attempt to subscribe even if it is already added | dev | qt/qtbase | Status: MERGED | +2 | 0 |
312929,2 | PostgreSQL: Attempt to subscribe even if it is already added | 5.15 | qt/qtbase | Status: MERGED | +2 | 0 |