src/hg/hgTables/schema.c 1.62

1.62 2010/04/11 21:55:27 kent
Starting to get makeItems custom tracks to work. Schema page is made now, though links in it don't work.
Index: src/hg/hgTables/schema.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/schema.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -b -B -U 4 -r1.61 -r1.62
--- src/hg/hgTables/schema.c	4 Jan 2010 19:12:23 -0000	1.61
+++ src/hg/hgTables/schema.c	11 Apr 2010 21:55:27 -0000	1.62
@@ -19,8 +19,9 @@
 #include "bedCart.h"
 #include "hgMaf.h"
 #include "hgTables.h"
 #include "wikiTrack.h"
+#include "makeItemsItem.h"
 
 static char const rcsid[] = "$Id$";
 
 static char *nbForNothing(char *val)
@@ -514,9 +515,32 @@
     hPrintf("</PRE></TT>\n");
     }
 }
 
-static void showSchemaCt(char *table)
+static void showSchemaMakeItems(char *db, char *trackId, struct customTrack *ct)
+/* Show schema on makeItems format custom track. */
+{
+struct asObject *asObj = asParseText(makeItemsItemAutoSqlString);
+struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
+char *table = ct->dbTableName;
+
+hPrintf("<B>Genome Database:</B> %s", db);
+hPrintf("<B>Track ID:</B> %s ", trackId);
+hPrintf("<B>MySQL table:</B> %s", table); 
+hPrintf("&nbsp;&nbsp;&nbsp;&nbsp;<B>Row Count:</B> ");
+printLongWithCommas(stdout, sqlTableSize(conn, table));
+hPrintf("<BR>\n");
+if (asObj != NULL)
+    hPrintf("<B>Format description:</B> %s<BR>", asObj->comment);
+describeFields(db, table, asObj, conn);
+
+webNewSection("Sample Rows");
+printSampleRows(10, conn, ct->dbTableName);
+printTrackHtml(ct->tdb);
+hFreeConn(&conn);
+}
+
+static void showSchemaCt(char *db, char *table)
 /* Show schema on custom track. */
 {
 struct customTrack *ct = ctLookupName(table);
 char *type = ct->tdb->type;
@@ -529,8 +553,10 @@
 else if (startsWithWord("maf", type))
     showSchemaCtMaf(table, ct);
 else if (startsWithWord("array", type))
     showSchemaCtArray(table, ct);
+else if (startsWithWord("makeItems", type))
+    showSchemaMakeItems(db, table, ct);
 else
     errAbort("Unrecognized customTrack type %s", type);
 }
 
@@ -546,9 +573,9 @@
 {
 if (hIsBigBed(database, table, curTrack, ctLookupName))
     showSchemaBigBed(table);
 else if (isCustomTrack(table))
-    showSchemaCt(table);
+    showSchemaCt(db, table);
 else if (sameWord(table, WIKI_TRACK_TABLE))
     showSchemaWiki(tdb, table);
 else
     showSchemaDb(db, tdb, table);