mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:06:08 +00:00
UI: ConfZoneManager: Fix transactions
This commit is contained in:
parent
06fa637328
commit
ffcdc3a515
@ -104,8 +104,10 @@ void ConfZoneManager::setUp()
|
||||
bool ConfZoneManager::addOrUpdateZone(Zone &zone)
|
||||
{
|
||||
bool ok = false;
|
||||
const bool isNew = (zone.zoneId == 0);
|
||||
|
||||
beginTransaction();
|
||||
|
||||
const bool isNew = (zone.zoneId == 0);
|
||||
if (isNew) {
|
||||
zone.zoneId = getFreeZoneId(sqliteDb());
|
||||
} else {
|
||||
@ -162,6 +164,8 @@ bool ConfZoneManager::updateZoneName(int zoneId, const QString &zoneName)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
beginTransaction();
|
||||
|
||||
const auto vars = QVariantList() << zoneId << zoneName;
|
||||
|
||||
sqliteDb()->executeEx(sqlUpdateZoneName, vars, 0, &ok);
|
||||
@ -177,11 +181,10 @@ bool ConfZoneManager::updateZoneName(int zoneId, const QString &zoneName)
|
||||
|
||||
bool ConfZoneManager::updateZoneEnabled(int zoneId, bool enabled)
|
||||
{
|
||||
if (!updateDriverZoneFlag(zoneId, enabled))
|
||||
return false;
|
||||
|
||||
bool ok = false;
|
||||
|
||||
beginTransaction();
|
||||
|
||||
const auto vars = QVariantList() << zoneId << enabled;
|
||||
|
||||
sqliteDb()->executeEx(sqlUpdateZoneEnabled, vars, 0, &ok);
|
||||
@ -190,6 +193,8 @@ bool ConfZoneManager::updateZoneEnabled(int zoneId, bool enabled)
|
||||
|
||||
if (ok) {
|
||||
emit zoneUpdated();
|
||||
|
||||
updateDriverZoneFlag(zoneId, enabled);
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -199,6 +204,8 @@ bool ConfZoneManager::updateZoneResult(const Zone &zone)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
beginTransaction();
|
||||
|
||||
const auto vars = QVariantList()
|
||||
<< zone.zoneId << zone.addressCount << zone.textChecksum << zone.binChecksum
|
||||
<< zone.sourceModTime << zone.lastRun << zone.lastSuccess;
|
||||
|
Loading…
Reference in New Issue
Block a user