8f472bf46eaaf901feb09e25edb4618410b1cd67 tdreszer Fri Jul 29 15:08:26 2011 -0700 Checking in a solution to hgApi/ajax call to get hub track metadata (redmine 3280). The fix is ifdef'd out until we are clear what we want. diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 1240857..ee82187 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -3758,56 +3758,65 @@ return trackTdb; } struct trackDb *tdbForTrack(char *db, char *track,struct trackDb **tdbList) /* Load trackDb object for a track. If track is composite, its subtracks * will also be loaded and inheritance will be handled; if track is a * subtrack then inheritance will be handled. (Unless a subtrack has * "noInherit on"...) This will die if the current database does not have * a trackDb, but will return NULL if track is not found. * MAY pass in prepopulated trackDb list, or may receive the trackDb list as an inout. */ { /* Get track list .*/ struct trackDb *theTdbs = NULL; if (tdbList == NULL || *tdbList == NULL) { -#ifdef NOTNOW /* this is handled by the routines that call us, removed - * from here because we don't have a cart down here */ +//#define HGAPI_NEEDS_THIS +#ifdef HGAPI_NEEDS_THIS + // This was removed becuase of missing cart. BUT CART ISN"T USED DOWN BLELOW + // NOTE: Currently any call to this (hub or not), makes a tdbList and leaks it! if (isHubTrack(track)) { struct hash *hash = hashNew(0); - theTdbs = hubConnectAddHubForTrackAndFindTdb(db, track, tdbList, hash); + // NOTE: cart is not even used! + theTdbs = hubConnectAddHubForTrackAndFindTdb((struct cart *)NULL,db, track, tdbList, hash); + return hashFindVal(hash, track); // leaks tdbList and hash } else -#endif +#endif///def HGAPI_NEEDS_THIS { theTdbs = hTrackDb(db); if (tdbList != NULL) *tdbList = theTdbs; } } else theTdbs = *tdbList; return rFindTrack(0, theTdbs, track); } struct trackDb *hTrackDbForTrackAndAncestors(char *db, char *track) /* Load trackDb object for a track. If need be grab its ancestors too. * This does not load children. hTrackDbForTrack will handle children, and * is actually faster if being called on lots of tracks. This function * though is faster on one or two tracks. */ { +#ifdef HGAPI_NEEDS_THIS +if (isHubTrack(track)) + return tdbForTrack(db, track,NULL); +#endif///def HGAPI_NEEDS_THIS + struct sqlConnection *conn = hAllocConn(db); struct trackDb *tdb = loadTrackDbForTrack(conn, track); struct trackDb *ancestor = tdb; for (;;) { /* Get name of previous generation if any handling both * composite and supertrack ancestor tags. */ char *parentTrack = NULL; char *parent = trackDbLocalSetting(ancestor, "parent"); if (parent != NULL) parentTrack = cloneFirstWord(parent); if (parentTrack == NULL) { char *super = trackDbLocalSetting(ancestor, "superTrack"); if (super != NULL && !startsWith("on", super))