mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
queryset-refactor: Fixed db column to model field mapping for Oracle backend.
Thanks, Justin Bronn. Fixed #7036. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d4956cb427
commit
c43a3d78b1
@ -28,8 +28,9 @@ def query_class(QueryClass, Database):
|
|||||||
def resolve_columns(self, row, fields=()):
|
def resolve_columns(self, row, fields=()):
|
||||||
from django.db.models.fields import DateField, DateTimeField, \
|
from django.db.models.fields import DateField, DateTimeField, \
|
||||||
TimeField, BooleanField, NullBooleanField, DecimalField, Field
|
TimeField, BooleanField, NullBooleanField, DecimalField, Field
|
||||||
|
index_start = len(self.extra_select.keys())
|
||||||
values = []
|
values = []
|
||||||
for value, field in map(None, row, fields):
|
for value, field in map(None, row[index_start:], fields):
|
||||||
if isinstance(value, Database.LOB):
|
if isinstance(value, Database.LOB):
|
||||||
value = value.read()
|
value = value.read()
|
||||||
# Oracle stores empty strings as null. We need to undo this in
|
# Oracle stores empty strings as null. We need to undo this in
|
||||||
@ -111,7 +112,6 @@ def query_class(QueryClass, Database):
|
|||||||
# not get the attribute on the returned models.
|
# not get the attribute on the returned models.
|
||||||
self.extra_select['rn'] = 'ROW_NUMBER() OVER (ORDER BY %s )' % rn_orderby
|
self.extra_select['rn'] = 'ROW_NUMBER() OVER (ORDER BY %s )' % rn_orderby
|
||||||
sql, params= super(OracleQuery, self).as_sql(with_limits=False)
|
sql, params= super(OracleQuery, self).as_sql(with_limits=False)
|
||||||
self.extra_select.pop('rn')
|
|
||||||
|
|
||||||
# Constructing the result SQL, using the initial select SQL
|
# Constructing the result SQL, using the initial select SQL
|
||||||
# obtained above.
|
# obtained above.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user