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): ...@@ -11,23 +11,23 @@ def register_tracing_function(f):
return f return f
def create_table(table, *values): def create_table(table, *columns):
# TODO: # TODO:
# - refactor # - refactor
# - optimize # - optimize
conn = sqlite3.connect(database) conn = sqlite3.connect(database)
c = conn.cursor() c = conn.cursor()
v = ', '.join(values) v = ', '.join(columns)
c.execute("CREATE TABLE IF NOT EXISTS %s (%s, UNIQUE (%s))" % (table, v, v)) c.execute("CREATE TABLE IF NOT EXISTS %s (%s, UNIQUE (%s))" % (table, v, v))
conn.commit() conn.commit()
conn.close() conn.close()
def trace(*args): def trace(*values):
conn = sqlite3.connect(database) conn = sqlite3.connect(database)
c = conn.cursor() c = conn.cursor()
try: try:
c.execute('INSERT INTO %s VALUES (%s)' % ( c.execute('INSERT INTO %s VALUES (%s)' % (
table, ', '.join(['?'] * len(args))), args) table, ', '.join(['?'] * len(values))), values)
except sqlite3.IntegrityError as e: except sqlite3.IntegrityError as e:
if not str(e).startswith('UNIQUE constraint failed:'): if not str(e).startswith('UNIQUE constraint failed:'):
raise 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