7cecddecb8e38de46a4fa31754d17abe0cc0b534
angie
  Tue May 1 15:38:40 2012 -0700
Turns out that snp135 yields unsorted output for 'where chrom="...' --for now, just sort all queries that have a where clause. (#6152)

diff --git src/hg/lib/annoStreamDb.c src/hg/lib/annoStreamDb.c
index 408fad4..3bdca0a 100644
--- src/hg/lib/annoStreamDb.c
+++ src/hg/lib/annoStreamDb.c
@@ -170,56 +170,45 @@
 safef(query, sizeof(query), "show index from %s", table);
 struct sqlResult *sr = sqlGetResult(conn, query);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     {
     if (sameString(row[4], field))
 	{
 	foundIndex = TRUE;
 	break;
 	}
     }
 sqlFreeResult(&sr);
 return foundIndex;
 }
 
-boolean tableMayNotBeSorted(char *table)
-/* Return TRUE if table name is recognized as one that gets ongoing updates. */
-{
-return (endsWith(table, "_mrna") ||
-	endsWith(table, "_est") ||
-	endsWith(table, "_intronEst") ||
-	sameString(table, "xenoMrna") ||
-	sameString(table, "xenoEst") ||
-	sameString(table, "refGene"));
-}
-
 struct annoStreamer *annoStreamDbNew(char *db, char *table, struct asObject *asObj)
 /* Create an annoStreamer (subclass) object from a database table described by asObj. */
 {
 struct sqlConnection *conn = hAllocConn(db);
 if (!sqlTableExists(conn, table))
     errAbort("annoStreamDbNew: table '%s' doesn't exist in database '%s'", table, db);
 struct annoStreamDb *self = NULL;
 AllocVar(self);
 struct annoStreamer *streamer = &(self->streamer);
 annoStreamerInit(streamer, asObj);
 streamer->rowType = arWords;
 streamer->setRegion = asdSetRegion;
 streamer->nextRow = asdNextRow;
 streamer->close = asdClose;
 self->conn = conn;
 self->table = cloneString(table);
 char *asFirstColumnName = streamer->asObj->columnList->name;
 if (sqlFieldIndex(self->conn, self->table, "bin") == 0)
     self->hasBin = 1;
 if (self->hasBin && !sameString(asFirstColumnName, "bin"))
     self->omitBin = 1;
 if (!asdInitBed3Fields(self))
     errAbort("annoStreamDbNew: can't figure out which fields of %s to use as "
 	     "{chrom, chromStart, chromEnd}.", table);
 // When a table has an index on endField, sometimes the query optimizer uses it
 // and that ruins the sorting.  Fortunately most tables don't anymore.
 self->hasEndFieldIndex = sqlTableHasIndexOn(self->conn, self->table, self->endField);
-self->notSorted = tableMayNotBeSorted(table);
+self->notSorted = TRUE; // True for more tables than I counted on, e.g. snp135 (bc it's packed??)
 return (struct annoStreamer *)self;
 }