summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp2
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp7
-rw-r--r--src/sql/kernel/qsqldriver.cpp5
-rw-r--r--src/sql/kernel/qsqldriver.h2
4 files changed, 11 insertions, 5 deletions
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 1109dfd62a..19722ac98c 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -1847,7 +1847,7 @@ void QIBaseDriver::qHandleEventNotification(void *updatedResultBuffer)
if (eBuffer->subscriptionState == QIBaseEventBuffer::Subscribed) {
emit notification(i.key());
- emit notification(i.key(), QSqlDriver::UnknownSource);
+ emit notification(i.key(), QSqlDriver::UnknownSource, QVariant());
}
else if (eBuffer->subscriptionState == QIBaseEventBuffer::Starting)
eBuffer->subscriptionState = QIBaseEventBuffer::Subscribed;
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.",
diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp
index 7e6a7f7386..9a4732b1a2 100644
--- a/src/sql/kernel/qsqldriver.cpp
+++ b/src/sql/kernel/qsqldriver.cpp
@@ -133,10 +133,11 @@ QSqlDriver::~QSqlDriver()
/*!
\since 5.0
- \fn QSqlDriver::notification(const QString &name, NotificationSource source)
+ \fn QSqlDriver::notification(const QString &name, NotificationSource source, const QString & payload)
This signal is emitted when the database posts an event notification
- that the driver subscribes to. \a name identifies the event notification, \a source indicates the signal source.
+ that the driver subscribes to. \a name identifies the event notification, \a source indicates the signal source,
+ \a payload holds the extra data optionally delivered with the notification.
\sa subscribeToNotification()
*/
diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h
index 3ca8092e16..cf293cda0f 100644
--- a/src/sql/kernel/qsqldriver.h
+++ b/src/sql/kernel/qsqldriver.h
@@ -122,7 +122,7 @@ public:
Q_SIGNALS:
void notification(const QString &name);
- void notification(const QString &name, QSqlDriver::NotificationSource source);
+ void notification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload);
protected:
virtual void setOpen(bool o);