This patch will make compose_query.cgi considerably faster.  It also has the
beginnings of a library for parsing a simple language (for expressing
conditionals) into SQL.  Right now, the language only understands &'s, |'s, and
most operators sql understands.  In the future, it'll understand ()'s, !'s, and
maybe others...but, given that the original compose_query.cgi only knew &'s and
='s, I didn't want to gate this patch for such support.  In addition, high on
my todo list is the ability to drill down into results by clicking on rows,
columns, and cells.


Signed-off-by: Jeremy Orlow <jorlow@google.com>

NB. mbligh changed the set calls to use the builtin class. If that doesn't
work, it's my fault ;-)



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1100 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/frontend.py b/tko/frontend.py
index 7b610a4..09f107b 100755
--- a/tko/frontend.py
+++ b/tko/frontend.py
@@ -72,13 +72,19 @@
 	rows = db.select(fields, 'test_view', where=where, group_by=group_by)
 
 	data = {}
+	x_set = set()
+	y_set = set()
+	status_set = set()
 	for (x, y, status, count) in rows:
 		if not data.has_key(x):
 			data[x] = {}
 		if not data[x].has_key(y):
 			data[x][y] = {}
 		data[x][y][status] = count
-	return data
+		x_set.add(x)
+		y_set.add(y)
+		status_set.add(status)
+	return (data, list(x_set), list(y_set), list(status_set))
 
 
 class anygroup: