Author: Alex
Date: 2011-09-10 15:02:13 -0700 (Sat, 10 Sep 2011)
New Revision: 16793

Modified:
   django/trunk/django/db/models/sql/compiler.py
Log:
Fixed bulk_insertion on databases which don't yet support it. Thanks to Justin 
Bronn for his Oracle wizardry.

Modified: django/trunk/django/db/models/sql/compiler.py
===================================================================
--- django/trunk/django/db/models/sql/compiler.py       2011-09-10 21:46:59 UTC 
(rev 16792)
+++ django/trunk/django/db/models/sql/compiler.py       2011-09-10 22:02:13 UTC 
(rev 16793)
@@ -814,7 +814,8 @@
             values = [[self.connection.ops.pk_default_value()] for obj in 
self.query.objs]
             params = [[]]
             fields = [None]
-        can_bulk = not any(hasattr(field, "get_placeholder") for field in 
fields) and not self.return_id
+        can_bulk = (not any(hasattr(field, "get_placeholder") for field in 
fields) and
+            not self.return_id and self.connection.features.has_bulk_insert)
 
         if can_bulk:
             placeholders = [["%s"] * len(fields)]
@@ -831,7 +832,7 @@
             result.append(r_fmt % col)
             params += r_params
             return [(" ".join(result), tuple(params))]
-        if can_bulk and self.connection.features.has_bulk_insert:
+        if can_bulk:
             result.append(self.connection.ops.bulk_insert_sql(fields, 
len(values)))
             return [(" ".join(result), tuple([v for val in values for v in 
val]))]
         else:

-- 
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?hl=en.

Reply via email to