Ticket #7065: oracle_regex_qsrf.diff

File oracle_regex_qsrf.diff, 1.6 KB (added by Erin Kelly, 17 years ago)
  • django/db/models/sql/where.py

     
    140140        elif lookup_type == 'search':
    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)
    146146
  • django/db/backends/oracle/base.py

     
    119119
    120120    def regex_lookup_10(self, lookup_type):
    121121        if lookup_type == 'regex':
    122             match_option = 'c'
     122            match_option = "'c'"
    123123        else:
    124             match_option = 'i'
    125         return 'REGEXP_LIKE(%%s %%s %s)' % match_option
     124            match_option = "'i'"
     125        return 'REGEXP_LIKE(%%s, %%s, %s)' % match_option
    126126
     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)
     133
    127134    def sql_flush(self, style, tables, sequences):
    128135        # Return a list of 'TRUNCATE x;', 'TRUNCATE y;',
    129136        # 'TRUNCATE z;'... style SQL statements
Back to Top