diff options
author | Matt Newell <newellm@blur.com> | 2012-03-22 10:42:56 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-31 08:40:55 +0200 |
commit | d5e9616e399e68838f99ae4c123930b330bc4221 (patch) | |
tree | 0ca966f2a5f6c9dd94de0e7932a2721b77340eea /src/sql/drivers/psql/qsql_psql.cpp | |
parent | 9b423b6e6920250f97b74aeb86f609cf55a5ee22 (diff) |
Add payload to QSqlDriver notification with PSQL implementation.
Postgres async notifications can contain a payload parameter
that is currently discarded. This patch provides the QSqlDriver
api change necessary to deliver a payload with each emitted
notification by adding a QVariant parameter to the notification
signal. It also provides the implementation for the qsqlpsql driver.
The qsql_ibase driver has been updated to reflect the change to the
notification signal signature.
The eventNotificationPSQL test in the qsqldatabase test has
been expanded to test proper payload sending and receiving.
All tests/auto/sql/kernel tests have been run with sqllite and
postgres with no regressions.
Task-number: QTBUG-13500
Change-Id: I9137f6acc8cfca93f45791ca930e0287d93d5d0d
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src/sql/drivers/psql/qsql_psql.cpp')
-rw-r--r-- | src/sql/drivers/psql/qsql_psql.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 10374bb51e..de7aa5ea78 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1377,9 +1377,14 @@ void QPSQLDriver::_q_handleNotification(int) while((notify = PQnotifies(d->connection)) != 0) { QString name(QLatin1String(notify->relname)); if (d->seid.contains(name)) { + QString payload; +#if defined PG_VERSION_NUM && PG_VERSION_NUM-0 >= 70400 + if (notify->extra) + payload = d->isUtf8 ? QString::fromUtf8(notify->extra) : QString::fromAscii(notify->extra); +#endif emit notification(name); QSqlDriver::NotificationSource source = (notify->be_pid == PQbackendPID(d->connection)) ? QSqlDriver::SelfSource : QSqlDriver::OtherSource; - emit notification(name, source); + emit notification(name, source, payload); } else qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.", |