diff --git a/django/core/management/sql.py b/django/core/management/sql.py
index 78cd17a..ea03e90 100644
a
|
b
|
def sql_all(app, style, connection):
|
145 | 145 | def _split_statements(content): |
146 | 146 | comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$") |
147 | 147 | statements = [] |
148 | | statement = "" |
| 148 | statement = [] |
149 | 149 | for line in content.split("\n"): |
150 | 150 | cleaned_line = comment_re.sub(r"\1", line).strip() |
151 | 151 | if not cleaned_line: |
152 | 152 | continue |
153 | | statement += cleaned_line |
154 | | if statement.endswith(";"): |
155 | | statements.append(statement) |
156 | | statement = "" |
| 153 | statement.append(cleaned_line) |
| 154 | if cleaned_line.endswith(";"): |
| 155 | statements.append(" ".join(statement)) |
| 156 | statement = [] |
157 | 157 | return statements |
158 | 158 | |
159 | 159 | |
diff --git a/tests/regressiontests/initial_sql_regress/sql/simple.sql b/tests/regressiontests/initial_sql_regress/sql/simple.sql
index 39363ba..abd9fee 100644
a
|
b
|
|
2 | 2 | INSERT INTO initial_sql_regress_simple (name) VALUES ('John'); -- another comment |
3 | 3 | INSERT INTO initial_sql_regress_simple (name) VALUES ('-- Comment Man'); |
4 | 4 | INSERT INTO initial_sql_regress_simple (name) VALUES ('Paul'); |
5 | | INSERT INTO initial_sql_regress_simple (name) VALUES ('Ringo'); |
| 5 | INSERT INTO initial_sql_regress_simple |
| 6 | VALUES (150, 'Ringo'); |
6 | 7 | INSERT INTO initial_sql_regress_simple (name) VALUES ('George'); |
7 | 8 | INSERT INTO initial_sql_regress_simple (name) VALUES ('Miles O''Brien'); |
8 | 9 | INSERT INTO initial_sql_regress_simple (name) VALUES ('Semicolon;Man'); |