Django

Code

Changeset 7444

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

queryset-refactor: Fixed some errors in Oracle regex handling that were
introduced in [7087]. Patch from Ian Kelly. Fixed #7065.

Files:

Legend:

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

    r7427 r7444  
    120120    def regex_lookup_10(self, lookup_type): 
    121121        if lookup_type == 'regex': 
    122             match_option = 'c' 
    123         else: 
    124             match_option = 'i' 
    125         return 'REGEXP_LIKE(%%s %%s %s)' % match_option 
     122            match_option = "'c'" 
     123        else: 
     124            match_option = "'i'" 
     125        return 'REGEXP_LIKE(%%s, %%s, %s)' % match_option 
     126 
     127    def regex_lookup(self, lookup_type): 
     128        # If regex_lookup is called before it's been initialized, then create 
     129        # a cursor to initialize it and recur. 
     130        from django.db import connection 
     131        connection.cursor() 
     132        return connection.ops.regex_lookup(lookup_type) 
    126133 
    127134    def sql_flush(self, style, tables, sequences): 
  • django/branches/queryset-refactor/django/db/models/sql/where.py

    r7252 r7444  
    141141            return (connection.ops.fulltext_search_sql(field_sql), params) 
    142142        elif lookup_type in ('regex', 'iregex'): 
    143             return connection.ops.regex_lookup % (field_sql, cast_sql), params 
     143            return connection.ops.regex_lookup(lookup_type) % (field_sql, cast_sql), params 
    144144 
    145145        raise TypeError('Invalid lookup_type: %r' % lookup_type)