Django

Code

Changeset 7443

Show
Ignore:
Timestamp:
04/23/08 02:30:30 (5 months ago)
Author:
mtredinnick
Message:

queryset-refactor: The change in [7438] didn't fix #7036 properly. This is a
more comprehensive diagnosis and fix from Ian Kelly. Fixed #7036.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/queryset-refactor/django/db/backends/oracle/query.py

    r7438 r7443  
    3030                 TimeField, BooleanField, NullBooleanField, DecimalField, Field 
    3131            index_start = len(self.extra_select.keys()) 
    32             values = [] 
     32            values = list(row[:index_start]) 
    3333            for value, field in map(None, row[index_start:], fields): 
    3434                if isinstance(value, Database.LOB): 
     
    109109 
    110110            # 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. 
    113112            self.extra_select['rn'] = 'ROW_NUMBER() OVER (ORDER BY %s )' % rn_orderby 
    114113            sql, params= super(OracleQuery, self).as_sql(with_limits=False) 
     
    126125            return ' '.join(result), params 
    127126 
     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 
    128141    _classes[QueryClass] = OracleQuery 
    129142    return OracleQuery