Mercurial > hg > orthanc
view OrthancServer/Sources/Database/InstallTrackAttachmentsSize.sql @ 4065:d6362b2c4b61 framework
export dcmdata in shared library, rounding in convolution tests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Jun 2020 18:04:28 +0200 |
parents | d25f4c0fa160 |
children | 28944db5318b |
line wrap: on
line source
CREATE TABLE GlobalIntegers( key INTEGER PRIMARY KEY, value INTEGER); INSERT INTO GlobalProperties VALUES (6, 1); -- GlobalProperty_GetTotalSizeIsFast INSERT INTO GlobalIntegers SELECT 0, IFNULL(SUM(compressedSize), 0) FROM AttachedFiles; INSERT INTO GlobalIntegers SELECT 1, IFNULL(SUM(uncompressedSize), 0) FROM AttachedFiles; CREATE TRIGGER AttachedFileIncrementSize AFTER INSERT ON AttachedFiles BEGIN UPDATE GlobalIntegers SET value = value + new.compressedSize WHERE key = 0; UPDATE GlobalIntegers SET value = value + new.uncompressedSize WHERE key = 1; END; CREATE TRIGGER AttachedFileDecrementSize AFTER DELETE ON AttachedFiles BEGIN UPDATE GlobalIntegers SET value = value - old.compressedSize WHERE key = 0; UPDATE GlobalIntegers SET value = value - old.uncompressedSize WHERE key = 1; END;