312123fe72695f041738fb3729961c31d5c9593e angie Wed May 11 10:19:13 2016 -0700 When the hgtaIntersectTable is carried over from a SQL database, but we have switched to a track hub database, various is functions were calling sql-only hdb functions. Added support for track hub db to hTableExists(); check existence before trying to determine the type of some table. diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index d2f38de..44597fb 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -758,30 +758,44 @@ boolean hCanHaveSplitTables(char *db) /* Return TRUE if split tables are allowed in database. */ { struct sqlConnection *conn = hAllocConn(db); int count = sqlTableSizeIfExists(conn, "chromInfo"); hFreeConn(&conn); return (count >= 0 && count <= HDB_MAX_SEQS_FOR_SPLIT); } static void tableListHashAdd(struct hash *dbTblHash, char *profile, char *db) /* Add to a hash that maps a track/table name (unsplit) to an slName list * of actual table names (possibly split) -- we can compute this once and * cache it to save a lot of querying if we will check existence of * lots of tables. */ { +if (trackHubDatabase(db)) + { + struct trackHub *hub = hubConnectGetHubForDb(db); + if (hub != NULL) + { + struct trackHubGenome *hubGenome = trackHubFindGenome(hub, db); + struct trackDb *tdbList = trackHubTracksForGenome(hub, hubGenome), *tdb; + for (tdb = tdbList; tdb != NULL; tdb = tdb->next) + { + hashAdd(dbTblHash, tdb->table, slNameNew(tdb->table)); + } + } + return; + } struct sqlConnection *conn = hAllocConnProfile(profile, db); struct slName *allTables = sqlListTables(conn); if (!sameString(CUSTOM_TRASH,db) && !sameString("hgFixed",db) && hCanHaveSplitTables(db)) { /* Consolidate split tables into one list per track: */ struct slName *tbl = NULL, *nextTbl = NULL; for (tbl = allTables; tbl != NULL; tbl = nextTbl) { struct hashEl *tHel = NULL; char trackName[HDB_MAX_TABLE_STRING]; char chrom[HDB_MAX_CHROM_STRING]; nextTbl = tbl->next; tbl->next = NULL; hParseTableName(db, tbl->name, trackName, chrom);