Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapperBase.cpp Tue Oct 13 16:57:55 2015 +0200 +++ b/OrthancServer/DatabaseWrapperBase.cpp Tue Oct 13 17:48:30 2015 +0200 @@ -33,6 +33,8 @@ #include "PrecompiledHeadersServer.h" #include "DatabaseWrapperBase.h" +#include "../Core/DicomFormat/DicomArray.h" + #include <stdio.h> namespace Orthanc @@ -309,6 +311,13 @@ s.BindInt64(0, id); s.Run(); } + + // New in DB v6 (Orthanc >= 0.9.5) + { + SQLite::Statement s(db_, SQLITE_FROM_HERE, "DELETE FROM SearchableStudies WHERE id=?"); + s.BindInt64(0, id); + s.Run(); + } } @@ -712,4 +721,27 @@ target.push_back(s.ColumnInt64(0)); } } + + + void DatabaseWrapperBase::StoreStudyModule(int64_t id, + const DicomMap& module) + { + DicomArray a(module); + + for (size_t i = 0; i < a.GetSize(); i++) + { + const DicomTag& tag = a.GetElement(i).GetTag(); + const DicomValue& value = a.GetElement(i).GetValue(); + + if (!value.IsNull()) + { + SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO SearchableStudies VALUES(?, ?, ?, ?)"); + s.BindInt64(0, id); + s.BindInt(1, tag.GetGroup()); + s.BindInt(2, tag.GetElement()); + s.BindString(3, value.AsString()); + s.Run(); + } + } + } }