Changeset 3178
- Timestamp:
- 06/20/06 03:00:44 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/management.py
r3177 r3178 334 334 # Some backends can't execute more than one SQL statement at a time, 335 335 # so split into separate statements. 336 sql_expr = re.compile( 337 r"""( # each statement ... 338 [^\r\n;] # starts with something other than a line ending or ';' 339 (?: # then has one or more chunks of ... 340 (?:[^;'"]+) # not the end of a statement or start of a quote 341 | (?:'[^']*') # something in single quotes 342 | (?:"[^"]*") # something in double quotes 343 )+)""", re.VERBOSE) 336 statements = re.compile(r";[ \t]*$", re.M) 344 337 345 338 # Find custom SQL, if it's available. … … 349 342 if os.path.exists(sql_file): 350 343 fp = open(sql_file) 351 output.extend(sql_expr.findall(fp.read())) 344 for statement in statements.split(fp.read()): 345 if statement.strip(): 346 output.append(statement + ";") 352 347 fp.close() 353 348 django/trunk/tests/regressiontests/initial_sql_regress/sql/simple.sql
r3177 r3178 3 3 INSERT INTO initial_sql_regress_simple (name) VALUES ('Ringo'); 4 4 INSERT INTO initial_sql_regress_simple (name) VALUES ('George'); 5 INSERT INTO initial_sql_regress_simple (name) VALUES ('Miles O''Brien'); 5 6
