add frontend matrix for performance benchmarks
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@694 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/db.py b/tko/db.py
index f696a42..32b02b4 100644
--- a/tko/db.py
+++ b/tko/db.py
@@ -41,21 +41,24 @@
sys.stderr.write('SQL: ' + str(value) + '\n')
- def select(self, fields, table, where):
+ def select(self, fields, table, where, distinct = False):
"""\
select fields from table where {dictionary}
"""
- cmd = 'select %s from %s' % (fields, table)
- values = []
+ cmd = ['select']
+ if distinct:
+ cmd.append('distinct')
+ cmd += [fields, 'from', table]
+ values = []
if where:
keys = [field + '=%s' for field in where.keys()]
values = [where[field] for field in where.keys()]
- cmd = cmd + ' where ' + ' and '.join(keys)
+ cmd.append(' where ' + ' and '.join(keys))
- self.dprint('%s %s' % (cmd,values))
- self.cur.execute(cmd, values)
+ self.dprint('%s %s' % (' '.join(cmd),values))
+ self.cur.execute(' '.join(cmd), values)
return self.cur.fetchall()