Bug #57513: Speed-up of CDB query.
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Oct 2009 03:37:57 +0000 (03:37 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Oct 2009 03:37:57 +0000 (03:37 +0000)
STEER/AliCDBGrid.cxx

index c91ca2a..f62e17f 100644 (file)
@@ -870,15 +870,23 @@ void AliCDBGrid::QueryValidFiles()
                return;
        }
 
-       AliCDBId validFileId;
-       for(int i=0; i<res->GetEntries(); i++){
-               TString filename = res->GetKey(i, "lfn");
-               if(filename == "") continue;
-               AliDebug(2,Form("Found valid file: %s", filename.Data()));
-               Bool_t result = FilenameToId(filename, validFileId);
-               if(result) {
-                       fValidFileIds.AddLast(validFileId.Clone());
-               }
+       TIter next(res);
+       TMap *map;
+       while ((map = (TMap*)next())) {
+         TObjString *entry;
+         if ((entry = (TObjString *) ((TMap *)map)->GetValue("lfn"))) {
+           TString& filename = entry->String();
+           if(filename.IsNull()) continue;
+           AliDebug(2,Form("Found valid file: %s", filename.Data()));
+           AliCDBId *validFileId = new AliCDBId;
+           Bool_t result = FilenameToId(filename, *validFileId);
+           if(result) {
+             fValidFileIds.AddLast(validFileId);
+           }
+           else {
+             delete validFileId;
+           }
+         }
        }
        delete res;