Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
192:c56dc32266e0 | 193:a1b9d1e1497b |
---|---|
941 result["Studies"] = studies; | 941 result["Studies"] = studies; |
942 return true; | 942 return true; |
943 } | 943 } |
944 | 944 |
945 | 945 |
946 bool ServerIndex::GetJsonFile(std::string& fileUuid, | |
947 const std::string& instanceUuid) | |
948 { | |
949 boost::mutex::scoped_lock scoped_lock(mutex_); | |
950 | |
951 SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT jsonUuid FROM Instances WHERE uuid=?"); | |
952 s.BindString(0, instanceUuid); | |
953 if (s.Step()) | |
954 { | |
955 fileUuid = s.ColumnString(0); | |
956 return true; | |
957 } | |
958 else | |
959 { | |
960 return false; | |
961 } | |
962 } | |
963 | |
964 bool ServerIndex::GetDicomFile(std::string& fileUuid, | |
965 const std::string& instanceUuid) | |
966 { | |
967 boost::mutex::scoped_lock scoped_lock(mutex_); | |
968 | |
969 SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT fileUuid FROM Instances WHERE uuid=?"); | |
970 s.BindString(0, instanceUuid); | |
971 if (s.Step()) | |
972 { | |
973 fileUuid = s.ColumnString(0); | |
974 return true; | |
975 } | |
976 else | |
977 { | |
978 return false; | |
979 } | |
980 } | |
981 | |
982 | |
983 bool ServerIndex::GetFile(std::string& fileUuid, | 946 bool ServerIndex::GetFile(std::string& fileUuid, |
947 CompressionType& compressionType, | |
984 const std::string& instanceUuid, | 948 const std::string& instanceUuid, |
985 const std::string& contentName) | 949 const std::string& contentName) |
986 { | 950 { |
987 if (contentName == "json") | 951 boost::mutex::scoped_lock scoped_lock(mutex_); |
988 { | 952 |
989 return GetJsonFile(fileUuid, instanceUuid); | 953 int64_t id; |
990 } | 954 ResourceType type; |
991 else if (contentName == "dicom") | 955 if (!db2_->LookupResource(instanceUuid, id, type) || |
992 { | 956 type != ResourceType_Instance) |
993 return GetDicomFile(fileUuid, instanceUuid); | |
994 } | |
995 else | |
996 { | 957 { |
997 throw OrthancException(ErrorCode_InternalError); | 958 throw OrthancException(ErrorCode_InternalError); |
998 } | 959 } |
960 | |
961 uint64_t compressedSize, uncompressedSize; | |
962 | |
963 return db2_->LookupFile(id, contentName, fileUuid, compressedSize, uncompressedSize, compressionType); | |
999 } | 964 } |
1000 | 965 |
1001 | 966 |
1002 | 967 |
1003 void ServerIndex::GetAllUuids(Json::Value& target, | 968 void ServerIndex::GetAllUuids(Json::Value& target, |