src/hg/lib/hdb.c 1.409

1.409 2009/08/14 07:16:16 aamp
Change to hGetBedRange() for custom tracks. The problem was that hParseTableName expected a database to be passed to it that included a chromInfo table. customTrash isn't one of those databases, so instead we're also including the name of the database being browsed.
Index: src/hg/lib/hdb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hdb.c,v
retrieving revision 1.408
retrieving revision 1.409
diff -b -B -U 4 -r1.408 -r1.409
--- src/hg/lib/hdb.c	12 Aug 2009 19:43:47 -0000	1.408
+++ src/hg/lib/hdb.c	14 Aug 2009 07:16:16 -0000	1.409
@@ -1653,9 +1653,9 @@
 hFreeConn(&conn);
 return desc;
 }
 
-struct bed *hGetBedRange(char *db, char *table, char *chrom, int chromStart,
+struct bed *hGetCtBedRange(char *db, char *browserDb, char *table, char *chrom, int chromStart,
 			 int chromEnd, char *sqlConstraints)
 /* Return a bed list of all items (that match sqlConstraints, if nonNULL)
  * in the given range in table.  If chromEnd is 0, omit the range (whole chrom).
  * WARNING: this does not use the bin column and maybe slower than you would like. */
@@ -1677,9 +1677,12 @@
 int i;
 boolean gotWhere = FALSE;
 
 /* Caller can give us either a full table name or root table name. */
-hParseTableName(db, table, rootName, parsedChrom);
+if (browserDb)
+    hParseTableName(browserDb, table, rootName, parsedChrom);
+else
+    hParseTableName(db, table, rootName, parsedChrom);
 hti = hFindTableInfo(db, chrom, rootName);
 if (hti == NULL)
     errAbort("Could not find table info for table %s (%s)",
 	     rootName, table);
@@ -1892,8 +1895,17 @@
 hFreeConn(&conn);
 return(bedList);
 }
 
+struct bed *hGetBedRange(char *db, char *table, char *chrom, int chromStart,
+			   int chromEnd, char *sqlConstraints)
+/* Return a bed list of all items (that match sqlConstraints, if nonNULL)
+ * in the given range in table.  If chromEnd is 0, omit the range (whole chrom).
+ * WARNING: this does not use the bin column and maybe slower than you would like. */
+{
+return hGetCtBedRange(db, NULL, table, chrom, chromStart, chromEnd, sqlConstraints);
+}
+
 int hGetBedRangeCount(char *db, char *table, char *chrom, int chromStart,
 			 int chromEnd, char *sqlConstraints)
 /* Return a count of all the items (that match sqlConstraints, if nonNULL)
  * in the given range in table.  If chromEnd is 0, omit the range (whole chrom).