mirror of
https://github.com/django/django.git
synced 2024-12-25 10:35:48 +00:00
Fixed #7886 -- Reordered some code in Query.results_iter() to ensure that all
the prequisites are correctly initialised prior to using them. Only affects Oracle and other db backends requiring resolve_columns() (e.g. MS SQL?) git-svn-id: http://code.djangoproject.com/svn/django/trunk@8112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
156b21a339
commit
2c6d1e8ebc
@ -197,14 +197,18 @@ class Query(object):
|
||||
Returns an iterator over the results from executing this query.
|
||||
"""
|
||||
resolve_columns = hasattr(self, 'resolve_columns')
|
||||
if resolve_columns:
|
||||
if self.select_fields:
|
||||
fields = self.select_fields + self.related_select_fields
|
||||
else:
|
||||
fields = self.model._meta.fields
|
||||
fields = None
|
||||
for rows in self.execute_sql(MULTI):
|
||||
for row in rows:
|
||||
if resolve_columns:
|
||||
if fields is None:
|
||||
# We only set this up here because
|
||||
# related_select_fields isn't populated until
|
||||
# execute_sql() has been called.
|
||||
if self.select_fields:
|
||||
fields = self.select_fields + self.related_select_fields
|
||||
else:
|
||||
fields = self.model._meta.fields
|
||||
row = self.resolve_columns(row, fields)
|
||||
yield row
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user