src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl 1.29

1.29 2010/03/20 00:15:36 tdreszer
Preferably use the new metaTbl over the trackDb and fileDb.ra settings.
Index: src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl,v
retrieving revision 1.28
retrieving revision 1.29
diff -b -B -U 4 -r1.28 -r1.29
--- src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl	2 Mar 2010 21:57:08 -0000	1.28
+++ src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl	20 Mar 2010 00:15:36 -0000	1.29
@@ -370,9 +371,28 @@
     }
     if(!$metaData{type}) {
         $metaData{type} = $dataType;
     }
+
+    # Use the metaTbl for metadata
+    my $queryResults = $db->execute("select var,val from $database.metaTbl where objName = '$tableName'");
+    if($queryResults) {
+        my @pairVars;
+        push @pairVars, "metadata";
+        while(my @row = $queryResults->fetchrow_array()) {
+
+            # FIXME: When trackDb metadata is no longer used, this routine should be replaced with more direct metaData loading
+            #$metaData{$row[0]} = $row[1];
+            push @pairVars, join('=',$row[0],$row[1] );
+            #my $onePair = join('=',$row[0],$row[1] );
+            #push @pairVars, $onePair;
+        }
+        $results = join(' ',@pairVars );
+    }
+
+    if(!$results) {
     $results = $db->quickQuery("select settings from $database.trackDb where tableName = '$tableName'");
+    }
     if(!$results) {
         ### TODO: This needs to be replaced with a select from a fileDb table
         if(stat("fileDb.ra")) {
             $results = `grep metadata fileDb.ra | grep '$fileName' | tail -1`;  # Always prefer the last line found