mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Fixed #23576 -- Implemented multi-alias fast-path deletion in MySQL backend.
This required moving the entirety of DELETE SQL generation to the compiler where it should have been in the first place and implementing a specialized compiler on MySQL/MariaDB. The MySQL compiler relies on the "DELETE table FROM table JOIN" syntax for queries spanning over multiple tables.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e645f27907
commit
7acef095d7
@@ -744,7 +744,10 @@ class QuerySet:
|
||||
Delete objects found from the given queryset in single direct SQL
|
||||
query. No signals are sent and there is no protection for cascades.
|
||||
"""
|
||||
return sql.DeleteQuery(self.model).delete_qs(self, using)
|
||||
query = self.query.clone()
|
||||
query.__class__ = sql.DeleteQuery
|
||||
cursor = query.get_compiler(using).execute_sql(CURSOR)
|
||||
return cursor.rowcount if cursor else 0
|
||||
_raw_delete.alters_data = True
|
||||
|
||||
def update(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user