Commit ed920af2 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

qa: use better parameter names

parent f6069026
......@@ -11,23 +11,23 @@ def register_tracing_function(f):
return f
def create_table(table, *values):
def create_table(table, *columns):
# TODO:
# - refactor
# - optimize
conn = sqlite3.connect(database)
c = conn.cursor()
v = ', '.join(values)
v = ', '.join(columns)
c.execute("CREATE TABLE IF NOT EXISTS %s (%s, UNIQUE (%s))" % (table, v, v))
conn.commit()
conn.close()
def trace(*args):
def trace(*values):
conn = sqlite3.connect(database)
c = conn.cursor()
try:
c.execute('INSERT INTO %s VALUES (%s)' % (
table, ', '.join(['?'] * len(args))), args)
table, ', '.join(['?'] * len(values))), values)
except sqlite3.IntegrityError as e:
if not str(e).startswith('UNIQUE constraint failed:'):
raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment