Commits

Michael Manfre  committed 8bd3c94

Enable has_bulk_insert database feature. Fixes #2

  • Participants
  • Parent commits 665aed3

Comments (0)

Files changed (2)

File sqlserver_ado/base.py

 
 class DatabaseFeatures(BaseDatabaseFeatures):
     uses_custom_query_class = True
+    has_bulk_insert = True
 
 # IP Address recognizer taken from:
 # http://mail.python.org/pipermail/python-list/2006-March/375505.html

File sqlserver_ado/operations.py

         first = datetime.datetime(value, 1, 1)
         second = datetime.datetime(value, 12, 31, 23, 59, 59, 999)
         return [first, second]
+
+    def bulk_insert_sql(self, fields, num_values):
+        """
+        Format the SQL for bulk insert
+        """
+        items_sql = "(%s)" % ", ".join(["%s"] * len(fields))
+        return "VALUES " + ", ".join([items_sql] * num_values)