1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +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): class SQLBulkUpdateCompiler(SQLCompiler):
def execute_sql(self, result_type): def execute_sql(self, result_type):
cursor = super().execute_sql(result_type) cursor = super().execute_sql(result_type)
if not cursor:
return 0
try: try:
rows = cursor.rowcount if cursor else 0 return cursor.rowcount
finally: finally:
if cursor:
cursor.close() cursor.close()
return rows
def get_update_clause(self, values): def get_update_clause(self, values):
qn = self.quote_name_unless_alias qn = self.quote_name_unless_alias