Mercurial > hg > orthanc
annotate Plugins/Samples/DatabasePlugin/Database.cpp @ 1672:4c5a85c3ff43 db-changes
sample database plugin now working
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Oct 2015 12:20:49 +0200 |
parents | 2f2e2ec17bc4 |
children | 0bbcfd9695e5 |
rev | line source |
---|---|
1671 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
22 * | |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #include "Database.h" | |
34 | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
35 #include "../../../Core/DicomFormat/DicomArray.h" |
1671 | 36 |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
37 #include <EmbeddedResources.h> |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
38 #include <boost/lexical_cast.hpp> |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
39 |
1671 | 40 |
41 namespace Internals | |
42 { | |
43 class SignalFileDeleted : public Orthanc::SQLite::IScalarFunction | |
44 { | |
45 private: | |
46 OrthancPlugins::DatabaseBackendOutput& output_; | |
47 | |
48 public: | |
49 SignalFileDeleted(OrthancPlugins::DatabaseBackendOutput& output) : output_(output) | |
50 { | |
51 } | |
52 | |
53 virtual const char* GetName() const | |
54 { | |
55 return "SignalFileDeleted"; | |
56 } | |
57 | |
58 virtual unsigned int GetCardinality() const | |
59 { | |
60 return 7; | |
61 } | |
62 | |
63 virtual void Compute(Orthanc::SQLite::FunctionContext& context) | |
64 { | |
65 std::string uncompressedMD5, compressedMD5; | |
66 | |
67 if (!context.IsNullValue(5)) | |
68 { | |
69 uncompressedMD5 = context.GetStringValue(5); | |
70 } | |
71 | |
72 if (!context.IsNullValue(6)) | |
73 { | |
74 compressedMD5 = context.GetStringValue(6); | |
75 } | |
76 | |
77 output_.SignalDeletedAttachment(context.GetStringValue(0), | |
78 context.GetIntValue(1), | |
79 context.GetInt64Value(2), | |
80 uncompressedMD5, | |
81 context.GetIntValue(3), | |
82 context.GetInt64Value(4), | |
83 compressedMD5); | |
84 } | |
85 }; | |
86 | |
87 | |
88 class SignalResourceDeleted : public Orthanc::SQLite::IScalarFunction | |
89 { | |
90 private: | |
91 OrthancPlugins::DatabaseBackendOutput& output_; | |
92 | |
93 public: | |
94 SignalResourceDeleted(OrthancPlugins::DatabaseBackendOutput& output) : output_(output) | |
95 { | |
96 } | |
97 | |
98 virtual const char* GetName() const | |
99 { | |
100 return "SignalResourceDeleted"; | |
101 } | |
102 | |
103 virtual unsigned int GetCardinality() const | |
104 { | |
105 return 2; | |
106 } | |
107 | |
108 virtual void Compute(Orthanc::SQLite::FunctionContext& context) | |
109 { | |
110 output_.SignalDeletedResource(context.GetStringValue(0), | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
111 Orthanc::Plugins::Convert(static_cast<Orthanc::ResourceType>(context.GetIntValue(1)))); |
1671 | 112 } |
113 }; | |
114 } | |
115 | |
116 | |
117 class Database::SignalRemainingAncestor : public Orthanc::SQLite::IScalarFunction | |
118 { | |
119 private: | |
120 bool hasRemainingAncestor_; | |
121 std::string remainingPublicId_; | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
122 OrthancPluginResourceType remainingType_; |
1671 | 123 |
124 public: | |
125 SignalRemainingAncestor() : | |
126 hasRemainingAncestor_(false) | |
127 { | |
128 } | |
129 | |
130 void Reset() | |
131 { | |
132 hasRemainingAncestor_ = false; | |
133 } | |
134 | |
135 virtual const char* GetName() const | |
136 { | |
137 return "SignalRemainingAncestor"; | |
138 } | |
139 | |
140 virtual unsigned int GetCardinality() const | |
141 { | |
142 return 2; | |
143 } | |
144 | |
145 virtual void Compute(Orthanc::SQLite::FunctionContext& context) | |
146 { | |
147 if (!hasRemainingAncestor_ || | |
148 remainingType_ >= context.GetIntValue(1)) | |
149 { | |
150 hasRemainingAncestor_ = true; | |
151 remainingPublicId_ = context.GetStringValue(0); | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
152 remainingType_ = Orthanc::Plugins::Convert(static_cast<Orthanc::ResourceType>(context.GetIntValue(1))); |
1671 | 153 } |
154 } | |
155 | |
156 bool HasRemainingAncestor() const | |
157 { | |
158 return hasRemainingAncestor_; | |
159 } | |
160 | |
161 const std::string& GetRemainingAncestorId() const | |
162 { | |
163 assert(hasRemainingAncestor_); | |
164 return remainingPublicId_; | |
165 } | |
166 | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
167 OrthancPluginResourceType GetRemainingAncestorType() const |
1671 | 168 { |
169 assert(hasRemainingAncestor_); | |
170 return remainingType_; | |
171 } | |
172 }; | |
173 | |
174 | |
175 | |
176 Database::Database(const std::string& path) : | |
177 path_(path), | |
178 base_(db_) | |
179 { | |
180 } | |
181 | |
182 | |
183 void Database::Open() | |
184 { | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
185 db_.Open(path_); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
186 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
187 // http://www.sqlite.org/pragma.html |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
188 db_.Execute("PRAGMA SYNCHRONOUS=NORMAL;"); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
189 db_.Execute("PRAGMA JOURNAL_MODE=WAL;"); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
190 db_.Execute("PRAGMA LOCKING_MODE=EXCLUSIVE;"); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
191 db_.Execute("PRAGMA WAL_AUTOCHECKPOINT=1000;"); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
192 //db_.Execute("PRAGMA TEMP_STORE=memory"); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
193 |
1671 | 194 if (!db_.DoesTableExist("GlobalProperties")) |
195 { | |
196 std::string query; | |
197 Orthanc::EmbeddedResources::GetFileResource(query, Orthanc::EmbeddedResources::PREPARE_DATABASE); | |
198 db_.Execute(query); | |
199 } | |
200 | |
201 signalRemainingAncestor_ = new SignalRemainingAncestor; | |
202 db_.Register(signalRemainingAncestor_); | |
203 db_.Register(new Internals::SignalFileDeleted(GetOutput())); | |
204 db_.Register(new Internals::SignalResourceDeleted(GetOutput())); | |
205 } | |
206 | |
207 | |
208 void Database::Close() | |
209 { | |
210 db_.Close(); | |
211 } | |
212 | |
213 | |
214 void Database::AddAttachment(int64_t id, | |
215 const OrthancPluginAttachment& attachment) | |
216 { | |
217 Orthanc::FileInfo info(attachment.uuid, | |
218 static_cast<Orthanc::FileContentType>(attachment.contentType), | |
219 attachment.uncompressedSize, | |
220 attachment.uncompressedHash, | |
221 static_cast<Orthanc::CompressionType>(attachment.compressionType), | |
222 attachment.compressedSize, | |
223 attachment.compressedHash); | |
224 base_.AddAttachment(id, info); | |
225 } | |
226 | |
227 | |
228 void Database::DeleteResource(int64_t id) | |
229 { | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
230 signalRemainingAncestor_->Reset(); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
231 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
232 Orthanc::SQLite::Statement s(db_, SQLITE_FROM_HERE, "DELETE FROM Resources WHERE internalId=?"); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
233 s.BindInt64(0, id); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
234 s.Run(); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
235 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
236 if (signalRemainingAncestor_->HasRemainingAncestor()) |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
237 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
238 GetOutput().SignalRemainingAncestor(signalRemainingAncestor_->GetRemainingAncestorId(), |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
239 signalRemainingAncestor_->GetRemainingAncestorType()); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
240 } |
1671 | 241 } |
242 | |
243 | |
244 static void Answer(OrthancPlugins::DatabaseBackendOutput& output, | |
245 const Orthanc::ServerIndexChange& change) | |
246 { | |
247 output.AnswerChange(change.GetSeq(), | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
248 change.GetChangeType(), |
1671 | 249 Orthanc::Plugins::Convert(change.GetResourceType()), |
250 change.GetPublicId(), | |
251 change.GetDate()); | |
252 } | |
253 | |
254 | |
255 static void Answer(OrthancPlugins::DatabaseBackendOutput& output, | |
256 const Orthanc::ExportedResource& resource) | |
257 { | |
258 output.AnswerExportedResource(resource.GetSeq(), | |
259 Orthanc::Plugins::Convert(resource.GetResourceType()), | |
260 resource.GetPublicId(), | |
261 resource.GetModality(), | |
262 resource.GetDate(), | |
263 resource.GetPatientId(), | |
264 resource.GetStudyInstanceUid(), | |
265 resource.GetSeriesInstanceUid(), | |
266 resource.GetSopInstanceUid()); | |
267 } | |
268 | |
269 | |
270 void Database::GetChanges(bool& done /*out*/, | |
271 int64_t since, | |
272 uint32_t maxResults) | |
273 { | |
274 typedef std::list<Orthanc::ServerIndexChange> Changes; | |
275 | |
276 Changes changes; | |
277 base_.GetChanges(changes, done, since, maxResults); | |
278 | |
279 for (Changes::const_iterator it = changes.begin(); it != changes.end(); ++it) | |
280 { | |
281 Answer(GetOutput(), *it); | |
282 } | |
283 } | |
284 | |
285 | |
286 void Database::GetExportedResources(bool& done /*out*/, | |
287 int64_t since, | |
288 uint32_t maxResults) | |
289 { | |
290 typedef std::list<Orthanc::ExportedResource> Resources; | |
291 | |
292 Resources resources; | |
293 base_.GetExportedResources(resources, done, since, maxResults); | |
294 | |
295 for (Resources::const_iterator it = resources.begin(); it != resources.end(); ++it) | |
296 { | |
297 Answer(GetOutput(), *it); | |
298 } | |
299 } | |
300 | |
301 | |
302 void Database::GetLastChange() | |
303 { | |
304 std::list<Orthanc::ServerIndexChange> change; | |
305 Orthanc::ErrorCode code = base_.GetLastChange(change); | |
306 | |
307 if (code != Orthanc::ErrorCode_Success) | |
308 { | |
309 throw OrthancPlugins::DatabaseException(static_cast<OrthancPluginErrorCode>(code)); | |
310 } | |
311 | |
312 if (!change.empty()) | |
313 { | |
314 Answer(GetOutput(), change.front()); | |
315 } | |
316 } | |
317 | |
318 | |
319 void Database::GetLastExportedResource() | |
320 { | |
321 std::list<Orthanc::ExportedResource> resource; | |
322 base_.GetLastExportedResource(resource); | |
323 | |
324 if (!resource.empty()) | |
325 { | |
326 Answer(GetOutput(), resource.front()); | |
327 } | |
328 } | |
329 | |
330 | |
331 void Database::GetMainDicomTags(int64_t id) | |
332 { | |
333 Orthanc::DicomMap tags; | |
334 base_.GetMainDicomTags(tags, id); | |
335 | |
336 Orthanc::DicomArray arr(tags); | |
337 for (size_t i = 0; i < arr.GetSize(); i++) | |
338 { | |
339 GetOutput().AnswerDicomTag(arr.GetElement(i).GetTag().GetGroup(), | |
340 arr.GetElement(i).GetTag().GetElement(), | |
341 arr.GetElement(i).GetValue().AsString()); | |
342 } | |
343 } | |
344 | |
345 | |
346 std::string Database::GetPublicId(int64_t resourceId) | |
347 { | |
348 std::string id; | |
349 if (base_.GetPublicId(id, resourceId)) | |
350 { | |
351 return id; | |
352 } | |
353 else | |
354 { | |
355 throw OrthancPlugins::DatabaseException(OrthancPluginErrorCode_UnknownResource); | |
356 } | |
357 } | |
358 | |
359 | |
360 OrthancPluginResourceType Database::GetResourceType(int64_t resourceId) | |
361 { | |
362 Orthanc::ResourceType result; | |
363 Orthanc::ErrorCode code = base_.GetResourceType(result, resourceId); | |
364 | |
365 if (code == Orthanc::ErrorCode_Success) | |
366 { | |
367 return Orthanc::Plugins::Convert(result); | |
368 } | |
369 else | |
370 { | |
371 throw OrthancPlugins::DatabaseException(static_cast<OrthancPluginErrorCode>(code)); | |
372 } | |
373 } | |
374 | |
375 | |
376 | |
377 template <typename I> | |
378 static void ConvertList(std::list<int32_t>& target, | |
379 const std::list<I>& source) | |
380 { | |
381 for (typename std::list<I>::const_iterator | |
382 it = source.begin(); it != source.end(); it++) | |
383 { | |
384 target.push_back(*it); | |
385 } | |
386 } | |
387 | |
388 | |
389 void Database::ListAvailableMetadata(std::list<int32_t>& target /*out*/, | |
390 int64_t id) | |
391 { | |
392 std::list<Orthanc::MetadataType> tmp; | |
393 base_.ListAvailableMetadata(tmp, id); | |
394 ConvertList(target, tmp); | |
395 } | |
396 | |
397 | |
398 void Database::ListAvailableAttachments(std::list<int32_t>& target /*out*/, | |
399 int64_t id) | |
400 { | |
401 std::list<Orthanc::FileContentType> tmp; | |
402 base_.ListAvailableAttachments(tmp, id); | |
403 ConvertList(target, tmp); | |
404 } | |
405 | |
406 | |
407 void Database::LogChange(const OrthancPluginChange& change) | |
408 { | |
409 int64_t id; | |
410 OrthancPluginResourceType type; | |
411 if (!LookupResource(id, type, change.publicId) || | |
412 type != change.resourceType) | |
413 { | |
414 throw OrthancPlugins::DatabaseException(OrthancPluginErrorCode_DatabasePlugin); | |
415 } | |
416 | |
417 Orthanc::ServerIndexChange tmp(change.seq, | |
418 static_cast<Orthanc::ChangeType>(change.changeType), | |
419 Orthanc::Plugins::Convert(change.resourceType), | |
420 change.publicId, | |
421 change.date); | |
422 | |
423 base_.LogChange(id, tmp); | |
424 } | |
425 | |
426 | |
427 void Database::LogExportedResource(const OrthancPluginExportedResource& resource) | |
428 { | |
429 Orthanc::ExportedResource tmp(resource.seq, | |
430 Orthanc::Plugins::Convert(resource.resourceType), | |
431 resource.publicId, | |
432 resource.modality, | |
433 resource.date, | |
434 resource.patientId, | |
435 resource.studyInstanceUid, | |
436 resource.seriesInstanceUid, | |
437 resource.sopInstanceUid); | |
438 | |
439 base_.LogExportedResource(tmp); | |
440 } | |
441 | |
442 | |
443 bool Database::LookupAttachment(int64_t id, | |
444 int32_t contentType) | |
445 { | |
446 Orthanc::FileInfo attachment; | |
447 if (base_.LookupAttachment(attachment, id, static_cast<Orthanc::FileContentType>(contentType))) | |
448 { | |
449 GetOutput().AnswerAttachment(attachment.GetUuid(), | |
450 attachment.GetContentType(), | |
451 attachment.GetUncompressedSize(), | |
452 attachment.GetUncompressedMD5(), | |
453 attachment.GetCompressionType(), | |
454 attachment.GetCompressedSize(), | |
455 attachment.GetCompressedMD5()); | |
456 return true; | |
457 } | |
458 else | |
459 { | |
460 return false; | |
461 } | |
462 } | |
463 | |
464 | |
465 bool Database::LookupParent(int64_t& parentId /*out*/, | |
466 int64_t resourceId) | |
467 { | |
468 bool found; | |
469 Orthanc::ErrorCode code = base_.LookupParent(found, parentId, resourceId); | |
470 | |
471 if (code == Orthanc::ErrorCode_Success) | |
472 { | |
473 return found; | |
474 } | |
475 else | |
476 { | |
477 throw OrthancPlugins::DatabaseException(static_cast<OrthancPluginErrorCode>(code)); | |
478 } | |
479 } | |
480 | |
481 | |
482 bool Database::LookupResource(int64_t& id /*out*/, | |
483 OrthancPluginResourceType& type /*out*/, | |
484 const char* publicId) | |
485 { | |
486 Orthanc::ResourceType tmp; | |
487 if (base_.LookupResource(id, tmp, publicId)) | |
488 { | |
489 type = Orthanc::Plugins::Convert(tmp); | |
490 return true; | |
491 } | |
492 else | |
493 { | |
494 return false; | |
495 } | |
496 } | |
497 | |
498 | |
499 void Database::StartTransaction() | |
500 { | |
501 transaction_.reset(new Orthanc::SQLite::Transaction(db_)); | |
502 transaction_->Begin(); | |
503 } | |
504 | |
505 | |
506 void Database::RollbackTransaction() | |
507 { | |
508 transaction_->Rollback(); | |
509 transaction_.reset(NULL); | |
510 } | |
511 | |
512 | |
513 void Database::CommitTransaction() | |
514 { | |
515 transaction_->Commit(); | |
516 transaction_.reset(NULL); | |
517 } | |
518 | |
519 | |
520 uint32_t Database::GetDatabaseVersion() | |
521 { | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
522 std::string version; |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
523 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
524 if (!LookupGlobalProperty(version, Orthanc::GlobalProperty_DatabaseSchemaVersion)) |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
525 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
526 throw OrthancPlugins::DatabaseException(OrthancPluginErrorCode_InternalError); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
527 } |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
528 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
529 try |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
530 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
531 return boost::lexical_cast<uint32_t>(version); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
532 } |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
533 catch (boost::bad_lexical_cast&) |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
534 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
535 throw OrthancPlugins::DatabaseException(OrthancPluginErrorCode_InternalError); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
536 } |
1671 | 537 } |
538 | |
539 | |
540 void Database::UpgradeDatabase(uint32_t targetVersion, | |
541 OrthancPluginStorageArea* storageArea) | |
542 { | |
543 } |