Sqlite: Relax LastChangedRowId

Change-Id: Ibc4637ebafd4c0cdedfcea5c52da5025435bc4ab
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2020-05-16 14:53:58 +02:00
committed by Tim Jenssen
parent 613dec7c92
commit 55d1f6b46e
2 changed files with 178 additions and 0 deletions

View File

@@ -36,6 +36,29 @@ namespace Sqlite {
class LastChangedRowId
{
public:
LastChangedRowId(DatabaseInterface &database)
: database(database)
{
callback = [=](ChangeType, char const *database, char const *table, long long rowId) {
this->lastRowId = rowId;
};
database.setUpdateHook(callback);
}
LastChangedRowId(DatabaseInterface &database, Utils::SmallStringView databaseName)
: database(database)
{
callback = [=](ChangeType, char const *database, char const *table, long long rowId) {
if (databaseName == database)
this->lastRowId = rowId;
};
database.setUpdateHook(callback);
}
LastChangedRowId(DatabaseInterface &database,
Utils::SmallStringView databaseName,
Utils::SmallStringView tableName)