comparison OrthancServer/DatabaseWrapperBase.cpp @ 1711:5ebd6cbb3da8 db-changes

Backed out changeset 2ad22b2970a2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Oct 2015 17:36:07 +0200
parents 2ad22b2970a2
children 4db9200c7f46
comparison
equal deleted inserted replaced
1709:2ad22b2970a2 1711:5ebd6cbb3da8
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
38 #include <stdio.h> 36 #include <stdio.h>
39 37
40 namespace Orthanc 38 namespace Orthanc
41 { 39 {
42 void DatabaseWrapperBase::SetGlobalProperty(GlobalProperty property, 40 void DatabaseWrapperBase::SetGlobalProperty(GlobalProperty property,
306 s.Run(); 304 s.Run();
307 } 305 }
308 306
309 { 307 {
310 SQLite::Statement s(db_, SQLITE_FROM_HERE, "DELETE FROM MainDicomTags WHERE id=?"); 308 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=?");
318 s.BindInt64(0, id); 309 s.BindInt64(0, id);
319 s.Run(); 310 s.Run();
320 } 311 }
321 } 312 }
322 313
719 while (s.Step()) 710 while (s.Step())
720 { 711 {
721 target.push_back(s.ColumnInt64(0)); 712 target.push_back(s.ColumnInt64(0));
722 } 713 }
723 } 714 }
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 }
747 } 715 }