044b178ab81d6bf91356f74812af4ecfc9bff212 hiram Tue Feb 8 11:54:30 2011 -0800 consolidate the display of data last updated printout for hgc clicks, now working for most bbi types diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index df8601e..b5a276b 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -4917,16 +4917,49 @@ char *bbiNameFromSettingOrTable(struct trackDb *tdb, struct sqlConnection *conn, char *table) /* Return file name from bigDataUrl or little table. */ { char *fileName = cloneString(trackDbSetting(tdb, "bigDataUrl")); if (fileName == NULL) { char query[256]; safef(query, sizeof(query), "select fileName from %s", table); fileName = sqlQuickString(conn, query); if (fileName == NULL) errAbort("Missing fileName in %s table", table); } return fileName; } +void printUpdateTime(char *database, struct trackDb *tdb, + struct customTrack *ct) +/* display table update time */ +{ +struct sqlConnection *conn = NULL; +char *tableName = NULL; +if (isCustomTrack(tdb->track)) + { + if (ct) + { + conn = hAllocConn(CUSTOM_TRASH); + tableName = ct->dbTableName; + } + } +else + { + tableName = hTableForTrack(database, tdb->table); + conn = hAllocConnTrack(database, tdb); + } +if (tableName) + { + char *date = firstWordInLine(sqlTableUpdate(conn, tableName)); + if (date != NULL) + printf("<B>Data last updated: </B>%s<BR>\n", date); + } +hFreeConn(&conn); +} +void printBbiUpdateTime(time_t *timep) +/* for bbi files, print out the timep value */ +{ + printf ("<B>Data last updated: %s</B><BR>\n", + sqlUnixTimeToDate(timep, FALSE)); +}