Skip to content
Snippets Groups Projects
Commit db2e350e authored by Mark Haines's avatar Mark Haines
Browse files

Wrap preparing the database in a transaction. Otherwise it will take many...

Wrap preparing the database in a transaction. Otherwise it will take many seconds to complete because sqlite will create a transaction per statement
parent 1342bced
No related branches found
No related tags found
No related merge requests found
...@@ -452,10 +452,11 @@ def prepare_database(db_conn): ...@@ -452,10 +452,11 @@ def prepare_database(db_conn):
db_conn.commit() db_conn.commit()
else: else:
sql_script = "BEGIN TRANSACTION;"
for sql_loc in SCHEMAS: for sql_loc in SCHEMAS:
sql_script = read_schema(sql_loc) sql_script += read_schema(sql_loc)
sql_script += "COMMIT TRANSACTION;"
c.executescript(sql_script) c.executescript(sql_script)
db_conn.commit() db_conn.commit()
c.execute("PRAGMA user_version = %d" % SCHEMA_VERSION) c.execute("PRAGMA user_version = %d" % SCHEMA_VERSION)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment