From 134ca4d438bd7cbe8f0f287a00d545f96fa04a01 Mon Sep 17 00:00:00 2001 From: Alex Hill Date: Tue, 4 Aug 2015 00:34:19 +1000 Subject: Fixed #24509 -- Added Expression support to SQLInsertCompiler --- django/db/backends/sqlite3/operations.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'django/db/backends/sqlite3') diff --git a/django/db/backends/sqlite3/operations.py b/django/db/backends/sqlite3/operations.py index 7f99eaa271..91d1a27f8a 100644 --- a/django/db/backends/sqlite3/operations.py +++ b/django/db/backends/sqlite3/operations.py @@ -226,13 +226,11 @@ class DatabaseOperations(BaseDatabaseOperations): value = uuid.UUID(value) return value - def bulk_insert_sql(self, fields, num_values): - res = [] - res.append("SELECT %s" % ", ".join( - "%%s AS %s" % self.quote_name(f.column) for f in fields - )) - res.extend(["UNION ALL SELECT %s" % ", ".join(["%s"] * len(fields))] * (num_values - 1)) - return " ".join(res) + def bulk_insert_sql(self, fields, placeholder_rows): + return " UNION ALL ".join( + "SELECT %s" % ", ".join(row) + for row in placeholder_rows + ) def combine_expression(self, connector, sub_expressions): # SQLite doesn't have a power function, so we fake it with a -- cgit v1.3