Mercurial > hg > orthanc-databases
comparison PostgreSQL/Plugins/CreateInstance.sql @ 72:8dd29af7c844 db-changes
new extension: FastTotalSize
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 04 Jan 2019 14:43:35 +0100 |
parents | d40c5fecd160 |
children | e61587582cef |
comparison
equal
deleted
inserted
replaced
71:d40c5fecd160 | 72:8dd29af7c844 |
---|---|
8 OUT isNewSeries BIGINT, | 8 OUT isNewSeries BIGINT, |
9 OUT isNewInstance BIGINT, | 9 OUT isNewInstance BIGINT, |
10 OUT patientKey BIGINT, | 10 OUT patientKey BIGINT, |
11 OUT studyKey BIGINT, | 11 OUT studyKey BIGINT, |
12 OUT seriesKey BIGINT, | 12 OUT seriesKey BIGINT, |
13 OUT instanceKey BIGINT) AS $$ | 13 OUT instanceKey BIGINT) AS $body$ |
14 | |
14 BEGIN | 15 BEGIN |
15 SELECT internalId FROM Resources INTO instanceKey WHERE publicId = instance AND resourceType = 3; | 16 SELECT internalId FROM Resources INTO instanceKey WHERE publicId = instance AND resourceType = 3; |
16 | 17 |
17 IF NOT (instanceKey IS NULL) THEN | 18 IF NOT (instanceKey IS NULL) THEN |
18 -- This instance already exists, stop here | 19 -- This instance already exists, stop here |
61 | 62 |
62 INSERT INTO Resources VALUES (DEFAULT, 3, instance, seriesKey) RETURNING internalId INTO instanceKey; | 63 INSERT INTO Resources VALUES (DEFAULT, 3, instance, seriesKey) RETURNING internalId INTO instanceKey; |
63 isNewInstance := 1; | 64 isNewInstance := 1; |
64 END IF; | 65 END IF; |
65 END; | 66 END; |
66 $$ LANGUAGE plpgsql; | 67 |
68 $body$ LANGUAGE plpgsql; |