summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-15 18:47:32 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-15 18:47:32 +0000
commit3b37c8151a06a2bebd51007db30ad436811b82c8 (patch)
tree2384a2408fcf22a7d014f3e8244f3845d17c54c1 /django/db/models/sql/query.py
parente867c5a0cc29977e926a836079061bf6a817f9af (diff)
Fixed #7411 -- worked around some possible transaction conflicts in SQLite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index f682c71d07..ef69d7657f 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1616,10 +1616,16 @@ class Query(object):
# The MULTI case.
if self.ordering_aliases:
- return order_modified_iter(cursor, len(self.ordering_aliases),
+ result = order_modified_iter(cursor, len(self.ordering_aliases),
self.connection.features.empty_fetchmany_value)
- return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
+ result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
self.connection.features.empty_fetchmany_value)
+ if not self.connection.features.can_use_chunked_reads:
+ # If we are using non-chunked reads, we return the same data
+ # structure as normally, but ensure it is all read into memory
+ # before going any further.
+ return list(result)
+ return result
# Use the backend's custom Query class if it defines one. Otherwise, use the
# default.