f796875d8c3fd7460f3837f7151962a6f92bf324
kent
  Wed Jun 14 09:50:54 2017 -0700
Respecting limit clause.

diff --git src/tabFile/tabQuery/tabQuery.c src/tabFile/tabQuery/tabQuery.c
index 8a2cc20..5e7bf0a 100644
--- src/tabFile/tabQuery/tabQuery.c
+++ src/tabFile/tabQuery/tabQuery.c
@@ -111,31 +111,31 @@
 int limit = rql->limit;
 for (row = gTable->rowList; row != NULL; row = row->next)
     {
     boolean pass = TRUE;
     if (rql->whereClause != NULL)
         {
 	struct rqlEval res = rqlEvalOnRecord(rql->whereClause, row, lookup, lm);
 	res = rqlEvalCoerceToBoolean(res);
 	pass = res.val.b;
 	}
     if (pass)
         {
 	++matchCount;
 	if (!doCount)
 	    {
-	    if (limit != 0 && matchCount > limit)
+	    if (limit > 0 && matchCount > limit)
 	        break;
 	    char *sep = "";
 	    for (field = rql->fieldList; field != NULL; field = field->next)
 		{
 		int fieldIx = hashIntVal(gFieldHash, field->name);
 		printf("%s%s", sep, row->row[fieldIx]);
 		sep = "\t";
 		}
 	    printf("\n");
 	    }
 	}
     }
 
 if (doCount)
     printf("%d\n", matchCount);