Author: ramiro Date: 2011-09-11 16:02:53 -0700 (Sun, 11 Sep 2011) New Revision: 16819
Modified: django/trunk/django/db/backends/oracle/base.py Log: Added an implementation of bulk insert via the ORM to the Oracle DB backend. Refs #7596, r16739 and http://troels.arvin.dk/db/rdbms/#insert-multiple Modified: django/trunk/django/db/backends/oracle/base.py =================================================================== --- django/trunk/django/db/backends/oracle/base.py 2011-09-11 22:36:16 UTC (rev 16818) +++ django/trunk/django/db/backends/oracle/base.py 2011-09-11 23:02:53 UTC (rev 16819) @@ -78,6 +78,7 @@ supports_bitwise_or = False can_defer_constraint_checks = True ignores_nulls_in_unique_constraints = False + has_bulk_insert = True class DatabaseOperations(BaseDatabaseOperations): compiler_module = "django.db.backends.oracle.compiler" @@ -372,7 +373,11 @@ name_length = self.max_name_length() - 3 return '%s_TR' % util.truncate_name(table, name_length).upper() + def bulk_insert_sql(self, fields, num_values): + items_sql = "SELECT %s FROM DUAL" % ", ".join(["%s"] * len(fields)) + return " UNION ALL ".join([items_sql] * num_values) + class _UninitializedOperatorsDescriptor(object): def __get__(self, instance, owner): -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.