src/hg/hgTables/asObj.c 1.3

1.3 2009/03/17 17:24:50 kent
Simplifying some logic where code was unnecessarily distinguishing between hPrintf and fprintf(stdout - which is an issue in the Genome Browser, but not here in the Table Browser. Also enabling select fields user interface.
Index: src/hg/hgTables/asObj.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/asObj.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 1000000 -r1.2 -r1.3
--- src/hg/hgTables/asObj.c	30 May 2008 18:38:45 -0000	1.2
+++ src/hg/hgTables/asObj.c	17 Mar 2009 17:24:50 -0000	1.3
@@ -1,72 +1,79 @@
 /* asObj - get and use parsed autoSQL objects describing table. */
 
 #include "common.h"
 #include "linefile.h"
 #include "jksql.h"
 #include "asParse.h"
 #include "errCatch.h"
 #include "hgTables.h"
 
 static char const rcsid[] = "$Id$";
 
 static struct asObject *asForTableOrDie(struct sqlConnection *conn, char *table)
 /* Get autoSQL description if any associated with table.   Abort if
  * there's a problem*/
 {
 struct asObject *asObj = NULL;
-if (sqlTableExists(conn, "tableDescriptions"))
+if (isBigBed(table))
+    {
+    asObj = bigBedAsForTable(table, conn);
+    }
+else
+    {
+    if (sqlTableExists(conn, "tableDescriptions"))
     {
     char query[256];
     char *asText = NULL;
 
     /* Try split table first. */
     safef(query, sizeof(query), 
     	"select autoSqlDef from tableDescriptions where tableName='chrN_%s'",
 	table);
     asText = sqlQuickString(conn, query);
 
     /* If no result try unsplit table. */
     if (asText == NULL)
 	{
 	safef(query, sizeof(query), 
 	    "select autoSqlDef from tableDescriptions where tableName='%s'",
 	    table);
 	asText = sqlQuickString(conn, query);
 	}
     if (asText != NULL && asText[0] != 0)
 	{
 	asObj = asParseText(asText);
 	}
     freez(&asText);
     }
+    }
 return asObj;
 }
 
 struct asObject *asForTable(struct sqlConnection *conn, char *table)
 /* Get autoSQL description if any associated with table. */
 /* Wrap some error catching around asForTable. */
 {
 struct errCatch *errCatch = errCatchNew();
 struct asObject *asObj = NULL;
 if (errCatchStart(errCatch))
     {
     asObj = asForTableOrDie(conn, table);
     }
 errCatchEnd(errCatch);
 errCatchFree(&errCatch);
 return asObj;
 }
 
 struct asColumn *asColumnFind(struct asObject *asObj, char *name)
 /* Return named column. */
 {
 struct asColumn *asCol = NULL;
 if (asObj!= NULL)
     {
     for (asCol = asObj->columnList; asCol != NULL; asCol = asCol->next)
         if (sameString(asCol->name, name))
 	     break;
     }
 return asCol;
 }