mirror of
https://github.com/django/django.git
synced 2025-07-06 02:39:12 +00:00
queryset-refactor: Fixed some errors in Oracle regex handling that were
introduced in [7087]. Patch from Ian Kelly. Fixed #7065. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7444 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5a9a208b7a
commit
382d31a981
@ -119,10 +119,17 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|||||||
|
|
||||||
def regex_lookup_10(self, lookup_type):
|
def regex_lookup_10(self, lookup_type):
|
||||||
if lookup_type == 'regex':
|
if lookup_type == 'regex':
|
||||||
match_option = 'c'
|
match_option = "'c'"
|
||||||
else:
|
else:
|
||||||
match_option = 'i'
|
match_option = "'i'"
|
||||||
return 'REGEXP_LIKE(%%s %%s %s)' % match_option
|
return 'REGEXP_LIKE(%%s, %%s, %s)' % match_option
|
||||||
|
|
||||||
|
def regex_lookup(self, lookup_type):
|
||||||
|
# If regex_lookup is called before it's been initialized, then create
|
||||||
|
# a cursor to initialize it and recur.
|
||||||
|
from django.db import connection
|
||||||
|
connection.cursor()
|
||||||
|
return connection.ops.regex_lookup(lookup_type)
|
||||||
|
|
||||||
def sql_flush(self, style, tables, sequences):
|
def sql_flush(self, style, tables, sequences):
|
||||||
# Return a list of 'TRUNCATE x;', 'TRUNCATE y;',
|
# Return a list of 'TRUNCATE x;', 'TRUNCATE y;',
|
||||||
|
@ -140,7 +140,7 @@ class WhereNode(tree.Node):
|
|||||||
elif lookup_type == 'search':
|
elif lookup_type == 'search':
|
||||||
return (connection.ops.fulltext_search_sql(field_sql), params)
|
return (connection.ops.fulltext_search_sql(field_sql), params)
|
||||||
elif lookup_type in ('regex', 'iregex'):
|
elif lookup_type in ('regex', 'iregex'):
|
||||||
return connection.ops.regex_lookup % (field_sql, cast_sql), params
|
return connection.ops.regex_lookup(lookup_type) % (field_sql, cast_sql), params
|
||||||
|
|
||||||
raise TypeError('Invalid lookup_type: %r' % lookup_type)
|
raise TypeError('Invalid lookup_type: %r' % lookup_type)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user