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>bb10
parent
8ea27bb1c6
commit
4351c2af45
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue