use COALESCE to ensure integer values

This commit is contained in:
Isaac Connor 2018-02-03 11:01:26 -05:00
parent e25af4b40c
commit 12c4ab07ea
2 changed files with 4 additions and 4 deletions

View File

@ -378,14 +378,14 @@ BEGIN
DELETE FROM Events_Archived WHERE EventId=OLD.Id; DELETE FROM Events_Archived WHERE EventId=OLD.Id;
UPDATE Monitors SET UPDATE Monitors SET
ArchivedEvents = ArchivedEvents - 1, ArchivedEvents = ArchivedEvents - 1,
ArchivedEventDiskSpace = ArchivedEventDiskSpace - OLD.DiskSpace, ArchivedEventDiskSpace = COALESCE(ArchivedEventDiskSpace,0) - COALESCE(OLD.DiskSpace,0),
TotalEvents = TotalEvents - 1, TotalEvents = TotalEvents - 1,
TotalEventDiskSpace = TotalEventDiskSpace - OLD.DiskSpace TotalEventDiskSpace = COALESCE(TotalEventDiskSpace,0) - COALESCE(OLD.DiskSpace,0)
WHERE Id=OLD.MonitorId; WHERE Id=OLD.MonitorId;
ELSE ELSE
UPDATE Monitors SET UPDATE Monitors SET
TotalEvents = TotalEvents-1, TotalEvents = TotalEvents-1,
TotalEventDiskSpace=TotalEventDiskSpace-OLD.DiskSpace TotalEventDiskSpace=COALESCE(TotalEventDiskSpace,0)-COALESCE(OLD.DiskSpace,0)
WHERE Id=OLD.MonitorId; WHERE Id=OLD.MonitorId;
END IF; END IF;
END; END;

View File

@ -1 +1 @@
1.31.32 1.31.33