Fix for --sql-file with comment lines

This commit is contained in:
Miroslav Štampar 2026-11-12 14:32:41 +01:00
parent b48a14a63b
commit 7827b2c389
2 changed files with 2 additions and 1 deletions

View file

@ -152,6 +152,7 @@ class Custom(object):
# User SQL is not a bundled procedure template: preserve literals and percent tokens.
snippet = readCachedFileContent(filename)
snippet = "\n".join(_ for _ in snippet.split("\n") if not re.match(r"\s*(--|#)", _)) # Note: only whole comment lines (literals stay intact)
queries = [_.strip() for _ in splitFields(snippet, delimiter=';' if zeroDepthSearch(snippet, ';') else '\n') if _.strip()]
if queries and all(query.upper().startswith("SELECT") for query in queries):