bd5ab545fd2f8439916541d8ba0bd74f7d16e504 kent Tue Mar 20 15:33:58 2012 -0700 Replacing a hash that gives a tdb for a track name with one that gives tdb for a table name. Addresses redmine 7222. diff --git src/hg/hgTables/schema.c src/hg/hgTables/schema.c index 42574d9..5d8398a 100644 --- src/hg/hgTables/schema.c +++ src/hg/hgTables/schema.c @@ -590,31 +590,31 @@ asObjectFree(&asObj); } else if (sameWord("pgSnp", type)) { struct asObject *asObj = pgSnpAsObj(); showSchemaWithAsObj(db, table, ct, asObj); asObjectFree(&asObj); } else errAbort("Unrecognized customTrack type %s", type); } static void showSchemaHub(char *db, char *table) /* Show schema on a hub track. */ { -struct trackDb *tdb = hashMustFindVal(fullTrackAndSubtrackHash, table); +struct trackDb *tdb = hashMustFindVal(fullTableToTdbHash, table); char *type = cloneFirstWord(tdb->type); hPrintf("Binary file of type %s stored at %s<BR>\n", type, trackDbSetting(tdb, "bigDataUrl")); if (sameString(type, "bigBed")) showSchemaBigBed(table); else if (sameString(type, "bam")) showSchemaBam(table); else if (sameString(type, "vcfTabix")) showSchemaVcf(table); } static void showSchemaWiki(struct trackDb *tdb, char *table) /* Show schema for the wikiTrack. */ { hPrintf("<B>User annotations to UCSC genes or genome regions</B><BR>\n"); @@ -674,52 +674,45 @@ { struct trackDb *sTdb = tdbRef->val; if (sameString(sTdb->table, curTable)) return TRUE; } } return FALSE; } void doSchema(struct sqlConnection *conn) /* Show schema around current track. */ { if (curTrackDescribesCurTable()) { char *table = connectingTableForTrack(curTable); - if (!isCustomTrack(table) && !hashFindVal(fullTrackAndSubtrackHash, table)) - hashAdd(fullTrackAndSubtrackHash, table, curTrack); + if (!isCustomTrack(table) && !hashFindVal(fullTableToTdbHash, table)) + hashAdd(fullTableToTdbHash, table, curTrack); htmlOpen("Schema for %s - %s", curTrack->shortLabel, curTrack->longLabel); showSchema(database, curTrack, table); htmlClose(); } else doTableSchema(database, curTable, conn); } struct asObject *asForTable(struct sqlConnection *conn, char *table) /* Get autoSQL description if any associated with table. */ /* Wrap some error catching around asForTable. */ { -struct trackDb *tdb = NULL; -if (isCustomTrack(table)) // Why isn't custom track in fullTrackAndSubtrackHash? - { - struct customTrack *ct = ctLookupName(table); - tdb = ct->tdb; - } -else - tdb = hashFindVal(fullTrackAndSubtrackHash, table); +struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table); if (tdb != NULL) return asForTdb(conn,tdb); // Some cases are for tables with no tdb! struct asObject *asObj = NULL; if (sqlTableExists(conn, "tableDescriptions")) { struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { char query[256]; safef(query, sizeof(query), "select autoSqlDef from tableDescriptions where tableName='%s'", table);