f236f0e852855ee84cd7e996a0345b2da65b67df angie Wed Jan 23 11:32:50 2013 -0800 Bug #9860 (TB paste IDs button not working for bigBed) - Steve foundthat while one can now get to the paste IDs page for bigBed, one can't get out of it -- clicking submit caused another illegal mysql query. Added the rest of the missing implementation for pasted/uploaded IDs for bigBed. diff --git src/hg/hgTables/identifiers.c src/hg/hgTables/identifiers.c index 5c4ef05..cbfcda3 100644 --- src/hg/hgTables/identifiers.c +++ src/hg/hgTables/identifiers.c @@ -285,46 +285,47 @@ (sameString(xrefTable, curTable) ? "where" : "and"), xrefTable, aliasField, skipToSpaces(extraWhere)); sr = sqlGetResult(conn, query->string); while ((row = sqlNextRow(sr)) != NULL) { if (sameString(row[0], row[1])) continue; touppers(row[0]); hashAdd(hash, row[0], lmCloneString(lm, row[1])); } sqlFreeResult(&sr); } static struct hash *getAllPossibleIds(struct sqlConnection *conn, struct lm *lm, char *idField, char *extraWhere) -/* Make a hash of all identifiers in curTable (and alias tables if specified) +/* If curTable is a custom track or bigFile, return NULL. Otherwise, + * make a hash of all identifiers in curTable (and alias tables if specified) * so that we can check the validity of pasted/uploaded identifiers. */ { +if (isCustomTrack(curTable) || isBamTable(curTable) || isVcfTable(curTable) || + isBigBed(database, curTable, curTrack, ctLookupName)) + return NULL; + struct hash *matchHash = hashNew(20); struct slName *tableList; char *xrefTable = NULL, *xrefIdField = NULL, *aliasField = NULL; struct sqlConnection *alternateConn = conn; if (sameWord(curTable, WIKI_TRACK_TABLE)) alternateConn = wikiConnect(); -if (isCustomTrack(curTable) || isBamTable(curTable) || isVcfTable(curTable)) - /* Currently we don't check whether these are valid CT item - * names or not. matchHash is empty for CTs. */ - tableList = NULL; -else if (sameWord(curTable, WIKI_TRACK_TABLE)) +if (sameWord(curTable, WIKI_TRACK_TABLE)) tableList = slNameNew(WIKI_TRACK_TABLE); else if (strchr(curTable, '.')) tableList = slNameNew(curTable); else tableList = hSplitTableNames(database, curTable); if (idField != NULL) addPrimaryIdsToHash(alternateConn, matchHash, idField, tableList, lm, extraWhere); getXrefInfo(alternateConn, &xrefTable, &xrefIdField, &aliasField); if (xrefTable != NULL) { addXrefIdsToHash(alternateConn, matchHash, idField, xrefTable, xrefIdField, aliasField, lm, extraWhere); } if (sameWord(curTable, WIKI_TRACK_TABLE)) wikiDisconnect(&alternateConn); @@ -400,34 +401,32 @@ } } lineFileClose(&lf); char *extraWhere = NULL; int maxIdsInWhere = cartUsualInt(cart, "hgt_maxIdsInWhere", DEFAULT_MAX_IDS_IN_WHERE); if (totalTerms > 0 && totalTerms <= maxIdsInWhere) extraWhere = slNameToInExpression(idField, allTerms); struct lm *lm = lmInit(0); struct hash *matchHash = getAllPossibleIds(conn, lm, idField, extraWhere); trashDirFile(&tn, "hgtData", "identifiers", ".key"); f = mustOpen(tn.forCgi, "w"); for (term = allTerms; term != NULL; term = term->next) { struct slName *matchList = NULL, *match; - if (isCustomTrack(curTable) || isBamTable(curTable) || isVcfTable(curTable)) + if (matchHash == NULL) { - /* Currently we don't check whether these are valid CT item - * names or not. matchHash is empty for CTs. */ matchList = slNameNew(term->name); } else { /* Support multiple alias->id mappings: */ char upcased[1024]; safecpy(upcased, sizeof(upcased), term->name); touppers(upcased); struct hashEl *hel = hashLookup(matchHash, upcased); if (hel != NULL) { matchList = slNameNew((char *)hel->val); while ((hel = hashLookupNext(hel)) != NULL) { match = slNameNew((char *)hel->val);