diff --git a/Data/SQLite/include/Poco/Data/SQLite/Notifier.h b/Data/SQLite/include/Poco/Data/SQLite/Notifier.h index ed27efa8f..03191b36c 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Notifier.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Notifier.h @@ -137,6 +137,9 @@ public: void setRow(Poco::Int64 row); /// Sets the row number. + const std::string& getTable() const; + /// Returns the table name. + const Poco::Dynamic::Var& getValue() const; /// Returns the value. @@ -155,6 +158,7 @@ private: const Session& _session; Poco::Dynamic::Var _value; Poco::Int64 _row; + std::string _table; EnabledEventType _enabledEvents; Poco::Mutex _mutex; }; @@ -168,6 +172,7 @@ inline bool Notifier::operator == (const Notifier& other) const { return _value == other._value && _row == other._row && + _table == other._table && Utility::dbHandle(_session) == Utility::dbHandle(other._session); } @@ -178,6 +183,12 @@ inline Poco::Int64 Notifier::getRow() const } +inline const std::string& Notifier::getTable() const +{ + return _table; +} + + inline void Notifier::setRow(Poco::Int64 row) /// Sets the row number. { diff --git a/Data/SQLite/src/Notifier.cpp b/Data/SQLite/src/Notifier.cpp index 1349563b7..b0306440e 100644 --- a/Data/SQLite/src/Notifier.cpp +++ b/Data/SQLite/src/Notifier.cpp @@ -163,16 +163,19 @@ void Notifier::sqliteUpdateCallbackFn(void* pVal, int opCode, const char* pDB, c if (opCode == Utility::OPERATION_INSERT) { pV->_row = row; + pV->_table = pTable; pV->insert.notify(pV); } else if (opCode == Utility::OPERATION_UPDATE) { pV->_row = row; + pV->_table = pTable; pV->update.notify(pV); } else if (opCode == Utility::OPERATION_DELETE) { pV->_row = row; + pV->_table = pTable; pV->erase.notify(pV); } } diff --git a/Data/SQLite/testsuite/src/SQLiteTest.cpp b/Data/SQLite/testsuite/src/SQLiteTest.cpp index 59529fb0e..636a3169c 100644 --- a/Data/SQLite/testsuite/src/SQLiteTest.cpp +++ b/Data/SQLite/testsuite/src/SQLiteTest.cpp @@ -2886,6 +2886,8 @@ void SQLiteTest::testNotifier() assert (_updateCounter == 3); assert (notifier.getRow() == 3); + assert (notifier.getTable() == "Person"); + notifier.setRow(0); // SQLite optimizes DELETE so here we must have // the WHERE clause to trigger per-row notifications