diff options
author | Jackson Taylor <jtaylor@classicalconversations.com> | 2021-11-01 16:02:32 -0400 |
---|---|---|
committer | Jackson Taylor <jtaylor@classicalconversations.com> | 2021-11-01 16:02:32 -0400 |
commit | 8d51d09e179884355d2c1f0cb28f2d67f29cbf88 (patch) | |
tree | 631017988ed017abda82b6dc4272f279344dced4 | |
parent | 98fbae3fd64d66e9c07e531aa9b49af04ceb57c3 (diff) |
Add scramble to solves table
This is the scramble that was generated from CsTimer
-rwxr-xr-x | jacsr | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -8,8 +8,13 @@ DATABASE_FILE = 'solves.db' def create_solve_table(connection): cursor = connection.cursor() + # TODO: Not sure what to do about DNF (Did Not Finish) solves statement = """ -CREATE TABLE solves (number integer primary key autoincrement, time datetime) + CREATE TABLE solves ( + number integer primary key autoincrement, + time datetime, + scramble text + ) """ cursor.execute(statement) cursor.close() @@ -22,9 +27,9 @@ def insert_times_into_db(connection, result_file): csv_file = csv.DictReader(f, delimiter=';') for line in csv_file: - # TODO: this is dangerous for sql injections. - cursor.execute( - 'INSERT into solves (time) VALUES (' + line['Time'] + ')') + # TODO: Add date, comment, etc. fields from CsTimer csv + cursor.execute("INSERT into solves (time, scramble) VALUES (?, ?)", + (line['Time'], line['Scramble'])) cursor.close() |