ed552b421c008dad0b93b880923362902bf1e3d1
max
Wed Apr 2 08:46:02 2014 -0700
Fixing hgVai again for gbib, refs #11957 and refs #12717. One problemwas that show tables cannot fail over. Probably need to libify
one day as a sqlShowTables() function. Another problem are the nib
directories in hg18. Working towards replacing all nib directories with their
twoBit versions via a hg.conf statement.
diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c
index 9314dd7..b378f3d 100644
--- src/hg/hgVai/hgVai.c
+++ src/hg/hgVai/hgVai.c
@@ -520,30 +520,33 @@
puts("
");
endCollapsibleSection();
}
char *findLatestSnpTable(char *suffix)
/* Return the name of the 'snp1__' table with the highest build number, if any. */
{
if (startsWith(hubTrackPrefix, database))
return NULL;
if (suffix == NULL)
suffix = "";
char query[64];
sqlSafef(query, sizeof(query), "show tables like 'snp1__%s'", suffix);
struct sqlConnection *conn = hAllocConn(database);
struct slName *snpNNNTables = sqlQuickList(conn, query);
+if (slCount(snpNNNTables)==0 && sqlFailoverConn(conn)!=NULL)
+ snpNNNTables = sqlQuickList(sqlFailoverConn(conn), query);
+
hFreeConn(&conn);
if (snpNNNTables == NULL)
return NULL;
// Skip to last in list -- highest number (show tables can't use rlike or 'order by'):
struct slName *table = snpNNNTables;
while (table->next != NULL && isdigit(table->next->name[4]) && isdigit(table->next->name[5]))
table = table->next;
char *tableName = NULL;
if (table != NULL)
tableName = cloneString(table->name);
slNameFreeList(&snpNNNTables);
return tableName;
}
boolean findSnpBed4(char *suffix, char **retFileName, struct trackDb **retTdb)