3c4d227e5ed8e06c8c03525b113b5a1204d8c5f5 max Mon Dec 9 19:04:48 2013 -0800 fixing bug that appeared when two pubs traks were activated diff --git src/hg/hgTracks/pubsTracks.c src/hg/hgTracks/pubsTracks.c index 26923a1..498911b 100644 --- src/hg/hgTracks/pubsTracks.c +++ src/hg/hgTracks/pubsTracks.c @@ -112,34 +112,32 @@ year = ""; authorYear = catTwoStrings(author, year); return authorYear; } static void setFormatFlag(struct sqlConnection* conn, char* tableName) /* We support two different storage places for article data: either the bed table directly * includes the title + author of the article or we have to look it up from the articles * table. Having a copy of the title in the bed table is faster * This function sets the flag to indicate the version we have in our table. * */ { if (seqTableFormat!=0) return; -if (sqlColumnExists(conn, tableName, "title")) - { +if (hHasField(sqlGetDatabase(conn), tableName, "title")) seqTableFormat = SEQTABLE_NEW; - } else seqTableFormat = SEQTABLE_OLD; } static struct pubsExtra *pubsMakeExtra(struct track* tg, char *articleTable, struct sqlConnection* conn, struct linkedFeatures* lf) /* bad solution: a function that is called before the extra field is * accessed and that fills it from a sql query. Will need to redo this like gencode, * drawing from atom, variome and bedLoadN or bedDetails */ { char query[LARGEBUF]; struct sqlResult *sr = NULL; char **row = NULL; struct pubsExtra *extra = NULL; @@ -283,30 +281,31 @@ return NULL; // convert list to hash struct hash *hashA = hashNew(0); struct slName *el; for (el = artIds; el != NULL; el = el->next) hashAddInt(hashA, el->name, 1); freeMem(keywords); slFreeList(artIds); return hashA; } static void pubsLoadKeywordYearItems(struct track *tg) /* load items that fulfill keyword and year filter */ { +seqTableFormat = 0; pubsParseClassColors(); struct sqlConnection *conn = hAllocConn(database); setFormatFlag(conn, tg->table); char *keywords = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsFilterKeywords"); char *yearFilter = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsFilterYear"); char *publFilter = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsFilterPublisher"); char *articleTable = pubsArticleTable(tg); if(sameOk(yearFilter, "anytime")) yearFilter = NULL; if(sameOk(publFilter, "all")) publFilter = NULL; if(isNotEmpty(keywords)) keywords = makeMysqlMatchStr(keywords);