Commit 442ee687 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #13349 -- Ensure that raw queries evaluate the entire query if the...

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
parent 2faa3acb
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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)