src/hg/hgTracks/bigBedTrack.c 1.6

1.6 2010/03/25 17:46:01 angie
Use hAllocConnTrack instead of sqlConnect or hAllocConn to support profiles in hg.conf.
Index: src/hg/hgTracks/bigBedTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/bigBedTrack.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -B -U 4 -r1.5 -r1.6
--- src/hg/hgTracks/bigBedTrack.c	10 Feb 2010 01:51:16 -0000	1.5
+++ src/hg/hgTracks/bigBedTrack.c	25 Mar 2010 17:46:01 -0000	1.6
@@ -6,8 +6,9 @@
 #include "hash.h"
 #include "linefile.h"
 #include "jksql.h"
 #include "hdb.h"
+#include "bedCart.h"
 #include "hgTracks.h"
 #include "hmmstats.h"
 #include "localmem.h"
 #include "wigCommon.h"
@@ -26,23 +27,23 @@
     errAbort("Missing fileName in %s table", table);
 return fileName;
 }
 
-struct bbiFile *fetchBbiForTrack(struct track *track)
+static struct bbiFile *fetchBbiForTrack(struct track *track)
 /* Fetch bbiFile from track, opening it if it is not already open. */
 {
 struct bbiFile *bbi = track->bbiFile;
 if (bbi == NULL)
     {
-    struct sqlConnection *conn = hAllocConn(database);
+    struct sqlConnection *conn = hAllocConnTrack(database, track->tdb);
     char *fileName = bbiNameFromTable(conn, track->mapName);
     hFreeConn(&conn);
     bbi = track->bbiFile = bigBedFileOpen(fileName);
     }
 return bbi;
 }
 
-struct bigBedInterval *bigBedSelectRange(struct sqlConnection *conn, struct track *track,
+struct bigBedInterval *bigBedSelectRange(struct track *track,
 	char *chrom, int start, int end, struct lm *lm)
 /* Return list of intervals in range. */
 {
 struct bbiFile *bbi = fetchBbiForTrack(track);
@@ -56,17 +57,17 @@
     }
 return result;
 }
 
-void bigBedAddLinkedFeaturesFrom(struct sqlConnection *conn, struct track *track,
+void bigBedAddLinkedFeaturesFrom(struct track *track,
 	char *chrom, int start, int end, int scoreMin, int scoreMax, boolean useItemRgb,
 	int fieldCount, struct linkedFeatures **pLfList)
 /* Read in items in chrom:start-end from bigBed file named in track->bbiFileName, convert
  * them to linkedFeatures, and add to head of list. */
 {
 struct lm *lm = lmInit(0);
 struct trackDb *tdb = track->tdb;
-struct bigBedInterval *bb, *bbList = bigBedSelectRange(conn, track, chrom, start, end, lm);
+struct bigBedInterval *bb, *bbList = bigBedSelectRange(track, chrom, start, end, lm);
 char *bedRow[32];
 char startBuf[16], endBuf[16];
 
 for (bb = bbList; bb != NULL; bb = bb->next)