Mercurial > hg > orthanc-databases
comparison SQLite/Plugins/SQLiteIndex.cpp @ 399:19bd3ee1f0b3 db-protobuf
support for labels in sqlite
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 07 Apr 2023 15:28:47 +0200 |
parents | 3d6886f3e5b3 |
children | 91124cc8a8c7 |
comparison
equal
deleted
inserted
replaced
398:8dedfd982b83 | 399:19bd3ee1f0b3 |
---|---|
164 "property INTEGER, value TEXT, PRIMARY KEY(server, property))"); | 164 "property INTEGER, value TEXT, PRIMARY KEY(server, property))"); |
165 } | 165 } |
166 | 166 |
167 t.Commit(); | 167 t.Commit(); |
168 } | 168 } |
169 | |
170 { | |
171 DatabaseManager::Transaction t(manager, TransactionType_ReadWrite); | |
172 | |
173 if (!t.GetDatabaseTransaction().DoesTableExist("Labels")) | |
174 { | |
175 t.GetDatabaseTransaction().ExecuteMultiLines( | |
176 "CREATE TABLE Labels(" | |
177 " id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE," | |
178 " label TEXT NOT NULL," | |
179 " PRIMARY KEY(id, label));" | |
180 "CREATE INDEX LabelsIndex1 ON Labels(id);" | |
181 "CREATE INDEX LabelsIndex2 ON Labels(label);"); | |
182 } | |
183 | |
184 t.Commit(); | |
185 } | |
169 } | 186 } |
170 | 187 |
171 | 188 |
172 SQLiteIndex::SQLiteIndex(OrthancPluginContext* context, | 189 SQLiteIndex::SQLiteIndex(OrthancPluginContext* context, |
173 const std::string& path) : | 190 const std::string& path) : |