Mercurial > hg > orthanc
diff OrthancServer/ServerIndex.cpp @ 193:a1b9d1e1497b
failed attempt to compile with linux standard base
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 13 Nov 2012 14:02:28 +0100 |
parents | c56dc32266e0 |
children | 0186ac92810c |
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp Tue Nov 13 11:29:43 2012 +0100 +++ b/OrthancServer/ServerIndex.cpp Tue Nov 13 14:02:28 2012 +0100 @@ -943,59 +943,24 @@ } - bool ServerIndex::GetJsonFile(std::string& fileUuid, - const std::string& instanceUuid) - { - boost::mutex::scoped_lock scoped_lock(mutex_); - - SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT jsonUuid FROM Instances WHERE uuid=?"); - s.BindString(0, instanceUuid); - if (s.Step()) - { - fileUuid = s.ColumnString(0); - return true; - } - else - { - return false; - } - } - - bool ServerIndex::GetDicomFile(std::string& fileUuid, - const std::string& instanceUuid) + bool ServerIndex::GetFile(std::string& fileUuid, + CompressionType& compressionType, + const std::string& instanceUuid, + const std::string& contentName) { boost::mutex::scoped_lock scoped_lock(mutex_); - SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT fileUuid FROM Instances WHERE uuid=?"); - s.BindString(0, instanceUuid); - if (s.Step()) - { - fileUuid = s.ColumnString(0); - return true; - } - else - { - return false; - } - } - - - bool ServerIndex::GetFile(std::string& fileUuid, - const std::string& instanceUuid, - const std::string& contentName) - { - if (contentName == "json") - { - return GetJsonFile(fileUuid, instanceUuid); - } - else if (contentName == "dicom") - { - return GetDicomFile(fileUuid, instanceUuid); - } - else + int64_t id; + ResourceType type; + if (!db2_->LookupResource(instanceUuid, id, type) || + type != ResourceType_Instance) { throw OrthancException(ErrorCode_InternalError); } + + uint64_t compressedSize, uncompressedSize; + + return db2_->LookupFile(id, contentName, fileUuid, compressedSize, uncompressedSize, compressionType); }