magic-removal: Fixed #1440 -- Changed django.core.management not to execute multiple SQL statements in the same cursor.execute(). Thanks, Malcolm Tredinnick

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-03-02 05:04:21 +00:00
parent 6dd46ebc50
commit 2695d52f50
2 changed files with 5 additions and 4 deletions

View File

@ -101,6 +101,7 @@ answer newbie questions, and generally made Django that much better:
Aaron Swartz <http://www.aaronsw.com/>
Tom Tobin
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
Malcolm Tredinnick
Amit Upadhyay
Milton Waddams
Rachel Willmer <http://www.willmer.com/kb/>

View File

@ -418,17 +418,17 @@ def syncdb():
created_models.add(model)
pending_references.update(references)
sql.extend(_get_sql_for_pending_references(model, pending_references))
sql = "\n".join(sql)
print "Creating table %s" % model._meta.db_table
cursor.execute(sql)
for statement in sql:
cursor.execute(statement)
for model in model_list:
if model in created_models:
sql = _get_many_to_many_sql_for_model(model)
if sql:
sql = '\n'.join(sql).strip()
print "Creating many-to-many tables for %s model" % model.__name__
cursor.execute(sql)
for statement in sql:
cursor.execute(statement)
transaction.commit_unless_managed()
syncdb.args = ''