Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 191:bff0b77b02fa
refactoring getalluuids
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 13 Nov 2012 11:22:33 +0100 |
parents | b6cef9d45cc3 |
children | c56dc32266e0 |
comparison
equal
deleted
inserted
replaced
190:b6cef9d45cc3 | 191:bff0b77b02fa |
---|---|
982 | 982 |
983 void ServerIndex::GetAllUuids(Json::Value& target, | 983 void ServerIndex::GetAllUuids(Json::Value& target, |
984 ResourceType resourceType) | 984 ResourceType resourceType) |
985 { | 985 { |
986 boost::mutex::scoped_lock scoped_lock(mutex_); | 986 boost::mutex::scoped_lock scoped_lock(mutex_); |
987 | 987 db2_->GetAllPublicIds(target, resourceType); |
988 std::string tableName; | |
989 | |
990 switch (resourceType) | |
991 { | |
992 case ResourceType_Patient: | |
993 tableName = "Patients"; | |
994 break; | |
995 | |
996 case ResourceType_Study: | |
997 tableName = "Studies"; | |
998 break; | |
999 | |
1000 case ResourceType_Series: | |
1001 tableName = "Series"; | |
1002 break; | |
1003 | |
1004 case ResourceType_Instance: | |
1005 tableName = "Instances"; | |
1006 break; | |
1007 | |
1008 default: | |
1009 throw OrthancException(ErrorCode_InternalError); | |
1010 } | |
1011 | |
1012 assert(target.type() == Json::arrayValue); | |
1013 | |
1014 std::string query = "SELECT uuid FROM " + tableName; | |
1015 SQLite::Statement s(db_, query); | |
1016 while (s.Step()) | |
1017 { | |
1018 target.append(s.ColumnString(0)); | |
1019 } | |
1020 } | 988 } |
1021 | 989 |
1022 | 990 |
1023 bool ServerIndex::GetChanges(Json::Value& target, | 991 bool ServerIndex::GetChanges(Json::Value& target, |
1024 int64_t since, | 992 int64_t since, |