1
0
mirror of https://github.com/django/django.git synced 2024-12-25 18:46:22 +00:00

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
This commit is contained in:
Russell Keith-Magee 2010-04-15 13:01:51 +00:00
parent 2faa3acb4b
commit 442ee687df

View File

@ -71,7 +71,13 @@ class RawQuery(object):
# Always execute a new query for a new iterator. # Always execute a new query for a new iterator.
# This could be optimized with a cache at the expense of RAM. # This could be optimized with a cache at the expense of RAM.
self._execute_query() 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): def __repr__(self):
return "<RawQuery: %r>" % (self.sql % self.params) return "<RawQuery: %r>" % (self.sql % self.params)