Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
199:dfa2899d9960 | 200:9c58b2b03cf0 |
---|---|
350 { | 350 { |
351 return defaultValue; | 351 return defaultValue; |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 | |
356 bool DatabaseWrapper::GetMetadataAsInteger(int& result, | |
357 int64_t id, | |
358 MetadataType type) | |
359 { | |
360 std::string s = GetMetadata(id, type, ""); | |
361 if (s.size() == 0) | |
362 { | |
363 return false; | |
364 } | |
365 | |
366 try | |
367 { | |
368 result = boost::lexical_cast<int>(s); | |
369 return true; | |
370 } | |
371 catch (boost::bad_lexical_cast&) | |
372 { | |
373 return false; | |
374 } | |
375 } | |
376 | |
377 | |
378 | |
355 void DatabaseWrapper::AttachFile(int64_t id, | 379 void DatabaseWrapper::AttachFile(int64_t id, |
356 AttachedFileType contentType, | 380 AttachedFileType contentType, |
357 const std::string& fileUuid, | 381 const std::string& fileUuid, |
358 uint64_t compressedSize, | 382 uint64_t compressedSize, |
359 uint64_t uncompressedSize, | 383 uint64_t uncompressedSize, |