Change variable name for clarity, strip out comment lines.
This commit is contained in:
parent
e487188617
commit
306ddf489c
1 changed files with 6 additions and 5 deletions
|
@ -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):
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue