Mercurial > hg > orthanc
diff OrthancServer/DatabaseWrapper.cpp @ 200:9c58b2b03cf0
refactoring of read operations
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 27 Nov 2012 16:49:22 +0100 |
parents | dfa2899d9960 |
children | 9283552c25df |
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp Tue Nov 27 16:20:22 2012 +0100 +++ b/OrthancServer/DatabaseWrapper.cpp Tue Nov 27 16:49:22 2012 +0100 @@ -352,6 +352,30 @@ } } + + bool DatabaseWrapper::GetMetadataAsInteger(int& result, + int64_t id, + MetadataType type) + { + std::string s = GetMetadata(id, type, ""); + if (s.size() == 0) + { + return false; + } + + try + { + result = boost::lexical_cast<int>(s); + return true; + } + catch (boost::bad_lexical_cast&) + { + return false; + } + } + + + void DatabaseWrapper::AttachFile(int64_t id, AttachedFileType contentType, const std::string& fileUuid,