f06563d466db42815448398cf80042714a8c9715
braney
Fri Mar 8 16:37:37 2013 -0800
another fix to avoid opening an SQL connection on assembly hub (#8072)
diff --git src/hg/hgTables/bigBed.c src/hg/hgTables/bigBed.c
index 0579576..3e33e43 100644
--- src/hg/hgTables/bigBed.c
+++ src/hg/hgTables/bigBed.c
@@ -9,30 +9,31 @@
#include "cheapcgi.h"
#include "cart.h"
#include "web.h"
#include "bed.h"
#include "hdb.h"
#include "trackDb.h"
#include "obscure.h"
#include "hmmstats.h"
#include "correlate.h"
#include "asParse.h"
#include "bbiFile.h"
#include "bigBed.h"
#include "hubConnect.h"
#include "asFilter.h"
#include "hgTables.h"
+#include "trackHub.h"
boolean isBigBed(char *database, char *table, struct trackDb *parent,
struct customTrack *(*ctLookupName)(char *table))
/* Local test to see if something is big bed. Handles hub tracks unlike hIsBigBed. */
{
struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table);
if (tdb)
return tdbIsBigBed(tdb);
else
return hIsBigBed(database, table, parent, ctLookupName);
}
static struct hash *asColumnHash(struct asObject *as)
/* Return a hash full of the object's columns, keyed by colum name */
@@ -332,31 +333,33 @@
{
slAddHead(&idList, slNameNew(row[3]));
outCount++;
}
}
lmCleanup(&lm);
bbiFileClose(&bbi);
freeMem(fileName);
return idList;
}
void showSchemaBigBed(char *table, struct trackDb *tdb)
/* Show schema on bigBed. */
{
/* Figure out bigBed file name and open it. Get contents for first chromosome as an example. */
-struct sqlConnection *conn = hAllocConn(database);
+struct sqlConnection *conn = NULL;
+if (!trackHubDatabase(database))
+ conn = hAllocConn(database);
char *fileName = bigBedFileName(table, conn);
struct bbiFile *bbi = bigBedFileOpen(fileName);
struct bbiChromInfo *chromList = bbiChromList(bbi);
struct lm *lm = lmInit(0);
struct bigBedInterval *ivList = getNElements(bbi, chromList, lm, 10);
/* Get description of columns, making it up from BED records if need be. */
struct asObject *as = bigBedAsOrDefault(bbi);
hPrintf("Database: %s", database);
hPrintf(" Primary Table: %s
", table);
hPrintf("Big Bed File: %s", fileName);
if (bbi->version >= 2)
{
hPrintf("
Item Count: ");