src/hg/hgc/hgc.c 1.1526

1.1526 2009/04/17 19:25:26 mikep
tagAlign tables have 'sequence' column instead of 'name' column, but otherwise are BED 6 and should be interpretable like that
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1525
retrieving revision 1.1526
diff -b -B -U 4 -r1.1525 -r1.1526
--- src/hg/hgc/hgc.c	8 Apr 2009 01:34:58 -0000	1.1525
+++ src/hg/hgc/hgc.c	17 Apr 2009 19:25:26 -0000	1.1526
@@ -1282,10 +1282,18 @@
 hFindSplitTable(database, seqName, tdb->tableName, table, &hasBin);
 if (bedSize <= 3)
     sprintf(query, "select * from %s where chrom = '%s' and chromStart = %d", table, seqName, start);
 else
+    {
+    // not sure how to free hti, I cant seen any code where an hti is ever freed.
+    struct hTableInfo *hti = hFindTableInfoWithConn(conn, seqName, tdb->tableName);
+    if (hti && *hti->nameField && differentString("name", hti->nameField))
+	sprintf(query, "select * from %s where %s = '%s' and chrom = '%s' and chromStart = %d",
+	    table, hti->nameField, escapedName, seqName, start);
+    else
     sprintf(query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
 	    table, escapedName, seqName, start);
+    }
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     if (firstTime)