Mercurial > hg > orthanc
comparison OrthancServer/DatabaseWrapperBase.cpp @ 1709:2ad22b2970a2 db-changes
SearchableStudies
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 13 Oct 2015 17:48:30 +0200 |
parents | 2f2e2ec17bc4 |
children | 5ebd6cbb3da8 |
comparison
equal
deleted
inserted
replaced
1708:275780da54ae | 1709:2ad22b2970a2 |
---|---|
31 | 31 |
32 | 32 |
33 #include "PrecompiledHeadersServer.h" | 33 #include "PrecompiledHeadersServer.h" |
34 #include "DatabaseWrapperBase.h" | 34 #include "DatabaseWrapperBase.h" |
35 | 35 |
36 #include "../Core/DicomFormat/DicomArray.h" | |
37 | |
36 #include <stdio.h> | 38 #include <stdio.h> |
37 | 39 |
38 namespace Orthanc | 40 namespace Orthanc |
39 { | 41 { |
40 void DatabaseWrapperBase::SetGlobalProperty(GlobalProperty property, | 42 void DatabaseWrapperBase::SetGlobalProperty(GlobalProperty property, |
304 s.Run(); | 306 s.Run(); |
305 } | 307 } |
306 | 308 |
307 { | 309 { |
308 SQLite::Statement s(db_, SQLITE_FROM_HERE, "DELETE FROM MainDicomTags WHERE id=?"); | 310 SQLite::Statement s(db_, SQLITE_FROM_HERE, "DELETE FROM MainDicomTags WHERE id=?"); |
311 s.BindInt64(0, id); | |
312 s.Run(); | |
313 } | |
314 | |
315 // New in DB v6 (Orthanc >= 0.9.5) | |
316 { | |
317 SQLite::Statement s(db_, SQLITE_FROM_HERE, "DELETE FROM SearchableStudies WHERE id=?"); | |
309 s.BindInt64(0, id); | 318 s.BindInt64(0, id); |
310 s.Run(); | 319 s.Run(); |
311 } | 320 } |
312 } | 321 } |
313 | 322 |
710 while (s.Step()) | 719 while (s.Step()) |
711 { | 720 { |
712 target.push_back(s.ColumnInt64(0)); | 721 target.push_back(s.ColumnInt64(0)); |
713 } | 722 } |
714 } | 723 } |
724 | |
725 | |
726 void DatabaseWrapperBase::StoreStudyModule(int64_t id, | |
727 const DicomMap& module) | |
728 { | |
729 DicomArray a(module); | |
730 | |
731 for (size_t i = 0; i < a.GetSize(); i++) | |
732 { | |
733 const DicomTag& tag = a.GetElement(i).GetTag(); | |
734 const DicomValue& value = a.GetElement(i).GetValue(); | |
735 | |
736 if (!value.IsNull()) | |
737 { | |
738 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO SearchableStudies VALUES(?, ?, ?, ?)"); | |
739 s.BindInt64(0, id); | |
740 s.BindInt(1, tag.GetGroup()); | |
741 s.BindInt(2, tag.GetElement()); | |
742 s.BindString(3, value.AsString()); | |
743 s.Run(); | |
744 } | |
745 } | |
746 } | |
715 } | 747 } |