diff options
| author | Alex Hill <alex@hill.net.au> | 2015-08-04 00:34:19 +1000 |
|---|---|---|
| committer | Josh Smeaton <josh.smeaton@gmail.com> | 2015-09-22 23:35:24 +1000 |
| commit | 134ca4d438bd7cbe8f0f287a00d545f96fa04a01 (patch) | |
| tree | 075ce7ffcc95819a0584e80f6611462894faea0c /django/db/backends/sqlite3 | |
| parent | 6e51d5d0e531c6aead9ebd638a63ffdc32245e5a (diff) | |
Fixed #24509 -- Added Expression support to SQLInsertCompiler
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/operations.py | 12 |
1 files changed, 5 insertions, 7 deletions
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 |
