Mercurial > hg > orthanc-databases
comparison PostgreSQL/Plugins/PostgreSQLStorageArea.cpp @ 237:35598014f140
refactoring to remove GlobalProperties.cpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 08 Apr 2021 19:09:04 +0200 |
parents | a4918d57435c |
children | d663d9e44f8d |
comparison
equal
deleted
inserted
replaced
236:d1d2edbbe6fb | 237:35598014f140 |
---|---|
51 { | 51 { |
52 PostgreSQLTransaction t(db, TransactionType_ReadWrite); | 52 PostgreSQLTransaction t(db, TransactionType_ReadWrite); |
53 | 53 |
54 if (!db.DoesTableExist("StorageArea")) | 54 if (!db.DoesTableExist("StorageArea")) |
55 { | 55 { |
56 db.Execute("CREATE TABLE IF NOT EXISTS StorageArea(" | 56 db.ExecuteMultiLines("CREATE TABLE IF NOT EXISTS StorageArea(" |
57 "uuid VARCHAR NOT NULL PRIMARY KEY," | 57 "uuid VARCHAR NOT NULL PRIMARY KEY," |
58 "content OID NOT NULL," | 58 "content OID NOT NULL," |
59 "type INTEGER NOT NULL)"); | 59 "type INTEGER NOT NULL)"); |
60 | 60 |
61 // Automatically remove the large objects associated with the table | 61 // Automatically remove the large objects associated with the table |
62 db.Execute("CREATE OR REPLACE RULE StorageAreaDelete AS ON DELETE " | 62 db.ExecuteMultiLines("CREATE OR REPLACE RULE StorageAreaDelete AS ON DELETE " |
63 "TO StorageArea DO SELECT lo_unlink(old.content);"); | 63 "TO StorageArea DO SELECT lo_unlink(old.content);"); |
64 } | 64 } |
65 | 65 |
66 t.Commit(); | 66 t.Commit(); |
67 } | 67 } |
68 } | 68 } |