Skip to content

Commit bbfbfa6

Browse files
committed
Better handle strings with multiple consecutive semicolons
1 parent f0555ce commit bbfbfa6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zigpy_cli/database.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ def sqlite3_split_statements(sql: str) -> list[str]:
2525
statements = []
2626
statement = ""
2727

28-
for chunk in sql.strip().split(";"):
29-
if not chunk:
30-
continue
28+
chunks = sql.strip().split(";")
29+
chunks_with_delimiter = [s + ";" for s in chunks[:-1]] + [chunks[-1]]
3130

32-
statement += chunk + ";"
31+
for chunk in chunks_with_delimiter:
32+
statement += chunk
3333

3434
if sqlite3.complete_statement(statement):
3535
statements.append(statement.strip())

0 commit comments

Comments
 (0)