21aba8d4cab3ea657db59d4f362c4331158cd86c
angie
  Thu Apr 23 11:51:28 2015 -0700
Apply some band-aids to fix broken filterFields for bigDataUrl-only bigBed tracks.
There are still way too many places in hgTables code that use isXyzTable(table, conn)
even when tdb is available.  I think all those places need to be fixed to pass in
tdb if they have it, or NULL if they don't.  The type-testers should use tdb if
possible, and fall back to using table & conn if tdb is NULL.
refs #14379, #15059

diff --git src/hg/hgTables/bigBed.c src/hg/hgTables/bigBed.c
index 0f839b5..a8a3eb2 100644
--- src/hg/hgTables/bigBed.c
+++ src/hg/hgTables/bigBed.c
@@ -93,38 +93,39 @@
 return hti;
 }
 
 struct slName *bigBedGetFields(char *table, struct sqlConnection *conn)
 /* Get fields of bigBed as simple name list. */
 {
 char *fileName = bigBedFileName(table, conn);
 struct bbiFile *bbi = bigBedFileOpen(fileName);
 struct asObject *as = bigBedAsOrDefault(bbi);
 struct slName *names = asColNames(as);
 freeMem(fileName);
 bbiFileClose(&bbi);
 return names;
 }
 
-struct sqlFieldType *bigBedListFieldsAndTypes(char *table, struct sqlConnection *conn)
+struct sqlFieldType *bigBedListFieldsAndTypes(struct trackDb *tdb, struct sqlConnection *conn)
 /* Get fields of bigBed as list of sqlFieldType. */
 {
-char *fileName = bigBedFileName(table, conn);
-struct bbiFile *bbi = bigBedFileOpen(fileName);
+char *fileOrUrl = bigFileNameFromCtOrHub(tdb->table, conn);
+if (fileOrUrl == NULL)
+    fileOrUrl = bbiNameFromSettingOrTable(tdb, conn, tdb->table);
+struct bbiFile *bbi = bigBedFileOpen(fileOrUrl);
 struct asObject *as = bigBedAsOrDefault(bbi);
 struct sqlFieldType *list = sqlFieldTypesFromAs(as);
-freeMem(fileName);
 bbiFileClose(&bbi);
 return list;
 }
 
 
 static void addFilteredBedsOnRegion(struct bbiFile *bbi, struct region *region,
 	char *table, struct asFilter *filter, struct lm *bedLm, struct bed **pBedList)
 /* Add relevant beds in reverse order to pBedList */
 {
 struct lm *bbLm = lmInit(0);
 struct bigBedInterval *ivList = NULL, *iv;
 ivList = bigBedIntervalQuery(bbi, region->chrom, region->start, region->end, 0, bbLm);
 char *row[bbi->fieldCount];
 char startBuf[16], endBuf[16];
 for (iv = ivList; iv != NULL; iv = iv->next)