From 306ddf489c955b31e7ecee318ed5f4b118cd4f0b Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 28 Mar 2022 14:18:43 -0700 Subject: [PATCH] Change variable name for clarity, strip out comment lines. --- voussoirkit/sqlhelpers.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/voussoirkit/sqlhelpers.py b/voussoirkit/sqlhelpers.py index aaec5af..0b933a1 100644 --- a/voussoirkit/sqlhelpers.py +++ b/voussoirkit/sqlhelpers.py @@ -151,12 +151,13 @@ def executescript(conn, script): The problem with Python's default executescript is that it executes a commit before running your script. If I wanted a commit I'd write one! ''' - lines = re.split(r';(:?\n|$)', script) - lines = (line.strip() for line in lines) - lines = (line for line in lines if line) + script = _remove_script_comments(script) + statements = re.split(r';(:?\n|$)', script) + statements = (statement.strip() for statement in statements) + statements = (statement for statement in statements if statement) cur = conn.cursor() - for line in lines: - cur.execute(line) + for statement in statements: + cur.execute(statement) def hex_byte(byte): '''