Ticket #7036: 7036_redux.diff
File 7036_redux.diff, 2.0 KB (added by , 17 years ago) |
---|
-
django/db/backends/oracle/query.py
29 29 from django.db.models.fields import DateField, DateTimeField, \ 30 30 TimeField, BooleanField, NullBooleanField, DecimalField, Field 31 31 index_start = len(self.extra_select.keys()) 32 values = []32 values = list(row[:index_start]) 33 33 for value, field in map(None, row[index_start:], fields): 34 34 if isinstance(value, Database.LOB): 35 35 value = value.read() … … 108 108 rn_orderby = '%s.%s' % (qn(opts.db_table), qn(opts.fields[0].db_column or opts.fields[0].column)) 109 109 110 110 # Getting the selection SQL and the params, which has the `rn` 111 # extra selection SQL; we pop `rn` after this completes so we do 112 # not get the attribute on the returned models. 111 # extra selection SQL. 113 112 self.extra_select['rn'] = 'ROW_NUMBER() OVER (ORDER BY %s )' % rn_orderby 114 113 sql, params= super(OracleQuery, self).as_sql(with_limits=False) 115 114 … … 125 124 # Returning the SQL w/params. 126 125 return ' '.join(result), params 127 126 127 def set_limits(self, low=None, high=None): 128 super(OracleQuery, self).set_limits(low, high) 129 130 # We need to select the row number for the LIMIT/OFFSET sql. 131 # A placeholder is added to extra_select now, because as_sql is 132 # too late to be modifying extra_select. However, the actual sql 133 # depends on the ordering, so that is generated in as_sql. 134 self.extra_select['rn'] = '1' 135 136 def clear_limits(self): 137 super(OracleQuery, self).clear_limits() 138 if 'rn' in self.extra_select: 139 del self.extra_select['rn'] 140 128 141 _classes[QueryClass] = OracleQuery 129 142 return OracleQuery 130 143