summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/psql/qsql_psql.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/sqldrivers/psql/qsql_psql.cpp')
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index ccaeca9362..d9fb343261 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -1198,8 +1198,7 @@ bool QPSQLDriver::open(const QString &db,
const QString &connOpts)
{
Q_D(QPSQLDriver);
- if (isOpen())
- close();
+ close();
QString connectString;
if (!host.isEmpty())
connectString.append(QLatin1String("host=")).append(qQuote(host));
@@ -1242,21 +1241,19 @@ bool QPSQLDriver::open(const QString &db,
void QPSQLDriver::close()
{
Q_D(QPSQLDriver);
- if (isOpen()) {
- d->seid.clear();
- if (d->sn) {
- disconnect(d->sn, SIGNAL(activated(QSocketDescriptor)), this, SLOT(_q_handleNotification()));
- delete d->sn;
- d->sn = nullptr;
- }
-
- if (d->connection)
- PQfinish(d->connection);
- d->connection = nullptr;
- setOpen(false);
- setOpenError(false);
+ d->seid.clear();
+ if (d->sn) {
+ disconnect(d->sn, SIGNAL(activated(QSocketDescriptor)), this, SLOT(_q_handleNotification()));
+ delete d->sn;
+ d->sn = nullptr;
}
+
+ if (d->connection)
+ PQfinish(d->connection);
+ d->connection = nullptr;
+ setOpen(false);
+ setOpenError(false);
}
QSqlResult *QPSQLDriver::createResult() const