diff options
| author | Michael Manfre <mmanfre@gmail.com> | 2014-01-08 23:31:34 -0500 |
|---|---|---|
| committer | Michael Manfre <mmanfre@gmail.com> | 2014-02-02 12:47:06 -0500 |
| commit | 0837eacc4e1fa7916e48135e8ba43f54a7a64997 (patch) | |
| tree | acd1f5961d3bbf1a59f9b3ca515712dad4c8e52a /django/db/models/sql/subqueries.py | |
| parent | ab2f21080d8b3112c1ba9a0bf923eae733be4242 (diff) | |
Made SQLCompiler.execute_sql(result_type) more explicit.
Updated SQLUpdateCompiler.execute_sql to match the behavior described in
the docstring; the 'first non-empty query' will now include all queries,
not just the main and first related update.
Added CURSOR and NO_RESULTS result_type constants to make the usages more
self documenting and allow execute_sql to explicitly close the cursor when
it is no longer needed.
Diffstat (limited to 'django/db/models/sql/subqueries.py')
| -rw-r--r-- | django/db/models/sql/subqueries.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index 86b1efd3f8..cfda1f552c 100644 --- a/django/db/models/sql/subqueries.py +++ b/django/db/models/sql/subqueries.py @@ -8,7 +8,7 @@ from django.db import connections from django.db.models.query_utils import Q from django.db.models.constants import LOOKUP_SEP from django.db.models.fields import DateField, DateTimeField, FieldDoesNotExist -from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE, SelectInfo +from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE, NO_RESULTS, SelectInfo from django.db.models.sql.datastructures import Date, DateTime from django.db.models.sql.query import Query from django.utils import six @@ -30,7 +30,7 @@ class DeleteQuery(Query): def do_query(self, table, where, using): self.tables = [table] self.where = where - self.get_compiler(using).execute_sql(None) + self.get_compiler(using).execute_sql(NO_RESULTS) def delete_batch(self, pk_list, using, field=None): """ @@ -82,7 +82,7 @@ class DeleteQuery(Query): values = innerq self.where = self.where_class() self.add_q(Q(pk__in=values)) - self.get_compiler(using).execute_sql(None) + self.get_compiler(using).execute_sql(NO_RESULTS) class UpdateQuery(Query): @@ -116,7 +116,7 @@ class UpdateQuery(Query): for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): self.where = self.where_class() self.add_q(Q(pk__in=pk_list[offset: offset + GET_ITERATOR_CHUNK_SIZE])) - self.get_compiler(using).execute_sql(None) + self.get_compiler(using).execute_sql(NO_RESULTS) def add_update_values(self, values): """ |
