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): '''