summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-04-15 13:01:51 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-04-15 13:01:51 +0000
commit442ee687df8eaa402f5ab8475a2b07c18188aba9 (patch)
tree82532860f12e04f0c6925cbc8d1e1045dbf1a0a5 /django/db/models/sql/query.py
parent2faa3acb4bb55f1830d517473c4bfb1616f92726 (diff)
Fixed #13349 -- Ensure that raw queries evaluate the entire query if the backend doesn't support chunked reads. Thanks to Alex Gaynor for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index dc455763be..cfe5d37a37 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -71,7 +71,13 @@ class RawQuery(object):
# Always execute a new query for a new iterator.
# This could be optimized with a cache at the expense of RAM.
self._execute_query()
- return iter(self.cursor)
+ if not connections[self.using].features.can_use_chunked_reads:
+ # If the database can't use chunked reads we need to make sure we
+ # evaluate the entire query up front.
+ result = list(self.cursor)
+ else:
+ result = self.cursor
+ return iter(result)
def __repr__(self):
return "<RawQuery: %r>" % (self.sql % self.params)