Change variable name for clarity, strip out comment lines.

This commit is contained in:
voussoir 2022-03-28 14:18:43 -07:00
parent e487188617
commit 306ddf489c
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

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