Author: adrian
Date: 2006-05-26 00:20:21 -0500 (Fri, 26 May 2006)
New Revision: 2985

Modified:
   django/trunk/AUTHORS
   django/trunk/django/core/management.py
Log:
Fixed #1935 -- Initial SQL data now works in SQLite if there are multiple 
statements. Thanks, [EMAIL PROTECTED]

Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS        2006-05-26 04:40:48 UTC (rev 2984)
+++ django/trunk/AUTHORS        2006-05-26 05:20:21 UTC (rev 2985)
@@ -65,6 +65,7 @@
     Robert Rock Howard <http://djangomojo.com/>
     Jason Huggins <http://www.jrandolph.com/blog/>
     Michael Josephson <http://www.sdjournal.com/>
+    [EMAIL PROTECTED]
     [EMAIL PROTECTED]
     Russell Keith-Magee <[EMAIL PROTECTED]>
     Garth Kidd <http://www.deadlybloodyserious.com/>

Modified: django/trunk/django/core/management.py
===================================================================
--- django/trunk/django/core/management.py      2006-05-26 04:40:48 UTC (rev 
2984)
+++ django/trunk/django/core/management.py      2006-05-26 05:20:21 UTC (rev 
2985)
@@ -328,13 +328,23 @@
     app_dir = 
os.path.normpath(os.path.join(os.path.dirname(models.get_app(model._meta.app_label).__file__),
 'sql'))
     output = []
 
+    # Some backends can't execute more than one SQL statement at a time,
+    # so split into separate statements.
+    sql_expr = re.compile(
+        r"""(           # each statement is...
+        (?:             # one or more chunks of ...
+            (?:[^;'"]+) # not the end of a statement or start of a quote
+          | (?:'[^']+') # something in single quotes
+          | (?:"[^"]+") # something in double quotes
+        )+)""", re.VERBOSE)
+
     # Find custom SQL, if it's available.
     sql_files = [os.path.join(app_dir, "%s.%s.sql" % 
(opts.object_name.lower(), settings.DATABASE_ENGINE)),
                  os.path.join(app_dir, "%s.sql" % opts.object_name.lower())]
     for sql_file in sql_files:
         if os.path.exists(sql_file):
             fp = open(sql_file)
-            output.append(fp.read())
+            output.extend(sql_expr.findall(fp.read()))
             fp.close()
 
     return output


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to