1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Update django/db/models/sql/compiler.py

Co-authored-by: Lily Foote <code@lilyf.org>
This commit is contained in:
Tom Forbes 2024-11-24 18:27:40 +00:00 committed by GitHub
parent c462ade332
commit fc31ef885d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2093,12 +2093,12 @@ class SQLUpdateCompiler(SQLCompiler):
class SQLBulkUpdateCompiler(SQLCompiler):
def execute_sql(self, result_type):
cursor = super().execute_sql(result_type)
if not cursor:
return 0
try:
rows = cursor.rowcount if cursor else 0
return cursor.rowcount
finally:
if cursor:
cursor.close()
return rows
cursor.close()
def get_update_clause(self, values):
qn = self.quote_name_unless_alias