d0306b151fe7bc779daa4a00f4cf5d4c3896d90f giardine Mon Oct 4 09:17:12 2010 -0700 Edits based on code review, and fix for pgSnp custom tracks diff --git src/hg/hgTables/schema.c src/hg/hgTables/schema.c index 6b566f0..1418738 100644 --- src/hg/hgTables/schema.c +++ src/hg/hgTables/schema.c @@ -531,56 +531,10 @@ } } -static void showSchemaMakeItems(char *db, char *trackId, struct customTrack *ct) -/* Show schema on makeItems format custom track. */ +static void showSchemaWithAutoSqlString(char *db, char *trackId, struct customTrack *ct, char *autoSqlString) +/* Show schema on custom track using autoSqlString defined for this track type. */ { -struct asObject *asObj = asParseText(makeItemsItemAutoSqlString); -struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH); -char *table = ct->dbTableName; - -hPrintf("Genome Database: %s ", db); -hPrintf("Track ID: %s ", trackId); -hPrintf("MySQL table: %s", table); -hPrintf("    Row Count: "); -printLongWithCommas(stdout, sqlTableSize(conn, table)); -hPrintf("
\n"); -if (asObj != NULL) - hPrintf("Format description: %s
", asObj->comment); -describeFields(CUSTOM_TRASH, table, asObj, conn); - -webNewSection("Sample Rows"); -printSampleRows(10, conn, ct->dbTableName); -printTrackHtml(ct->tdb); -hFreeConn(&conn); -} - -static void showSchemaBedDetail(char *db, char *trackId, struct customTrack *ct) -/* Show schema on bedDetail format custom track. */ -{ -struct asObject *asObj = asParseText(bedDetailAutoSqlString); -struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH); -char *table = ct->dbTableName; - -hPrintf("Genome Database: %s ", db); -hPrintf("Track ID: %s ", trackId); -hPrintf("MySQL table: %s", table); -hPrintf("    Row Count: "); -printLongWithCommas(stdout, sqlTableSize(conn, table)); -hPrintf("
\n"); -if (asObj != NULL) - hPrintf("Format description: %s
", asObj->comment); -describeFields(CUSTOM_TRASH, table, asObj, conn); - -webNewSection("Sample Rows"); -printSampleRows(10, conn, ct->dbTableName); -printTrackHtml(ct->tdb); -hFreeConn(&conn); -} - -static void showSchemaPgSnp(char *db, char *trackId, struct customTrack *ct) -/* Show schema on pgSnp format custom track. */ -{ -struct asObject *asObj = asParseText(pgSnpAutoSqlString); +struct asObject *asObj = asParseText(autoSqlString); struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH); char *table = ct->dbTableName; @@ -616,11 +570,11 @@ else if (startsWithWord("array", type)) showSchemaCtArray(table, ct); else if (startsWithWord("makeItems", type)) - showSchemaMakeItems(db, table, ct); + showSchemaWithAutoSqlString(db, table, ct, makeItemsItemAutoSqlString); else if (sameWord("bedDetail", type)) - showSchemaBedDetail(db, table, ct); + showSchemaWithAutoSqlString(db, table, ct, bedDetailAutoSqlString); else if (sameWord("pgSnp", type)) - showSchemaPgSnp(db, table, ct); + showSchemaWithAutoSqlString(db, table, ct, pgSnpAutoSqlString); else errAbort("Unrecognized customTrack type %s", type); }