diff options
author | Lorenz Haas <lorenz.haas@histomatics.de> | 2016-11-29 20:04:12 +0100 |
---|---|---|
committer | Lorenz Haas <lorenz.haas@histomatics.de> | 2017-03-16 17:41:41 +0000 |
commit | 4351c2af45768bcb68b5bb996c1fb6e24dc9556b (patch) | |
tree | 9657bc22deae75b4669492ebf859c40d93f736d0 /src/plugins/sqldrivers/psql | |
parent | 8ea27bb1c669e21100a6a042b0378b3346bdf671 (diff) |
Fix postgres notification subscription on LISTEN failure
Register a notification only if the LISTEN call was successful. This
behaves now like the UNLISTEN case: the notification is only unregistered
if the call was successful.
Change-Id: I2b18ec3a619fea5bed0a319013ad9df4b9e15456
Reviewed-by: Matt Newell <newellm@blur.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/psql')
-rw-r--r-- | src/plugins/sqldrivers/psql/qsql_psql.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index e0f9222902..fecfda22d5 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -1420,6 +1420,7 @@ bool QPSQLDriver::subscribeToNotification(const QString &name) QString query = QLatin1String("LISTEN ") + escapeIdentifier(name, QSqlDriver::TableName); PGresult *result = d->exec(query); if (PQresultStatus(result) != PGRES_COMMAND_OK) { + d->seid.removeLast(); setLastError(qMakeError(tr("Unable to subscribe"), QSqlError::StatementError, d, result)); PQclear(result); return false; |