Fixed #11017: Changed implementation of Oracle LIKE lookups to enable index usage. Thanks to Jani Tiainen for this workaround.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ian Kelly 2010-01-25 19:28:36 +00:00
parent 65c1dfe67b
commit 9cd1d6ed87
1 changed files with 6 additions and 6 deletions

View File

@ -314,16 +314,16 @@ class DatabaseWrapper(BaseDatabaseWrapper):
operators = { operators = {
'exact': '= %s', 'exact': '= %s',
'iexact': '= UPPER(%s)', 'iexact': '= UPPER(%s)',
'contains': "LIKEC %s ESCAPE '\\'", 'contains': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
'icontains': "LIKEC UPPER(%s) ESCAPE '\\'", 'icontains': "LIKE UPPER(TRANSLATE(%s USING NCHAR_CS)) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
'gt': '> %s', 'gt': '> %s',
'gte': '>= %s', 'gte': '>= %s',
'lt': '< %s', 'lt': '< %s',
'lte': '<= %s', 'lte': '<= %s',
'startswith': "LIKEC %s ESCAPE '\\'", 'startswith': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
'endswith': "LIKEC %s ESCAPE '\\'", 'endswith': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
'istartswith': "LIKEC UPPER(%s) ESCAPE '\\'", 'istartswith': "LIKE UPPER(TRANSLATE(%s USING NCHAR_CS)) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
'iendswith': "LIKEC UPPER(%s) ESCAPE '\\'", 'iendswith': "LIKE UPPER(TRANSLATE(%s USING NCHAR_CS)) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
} }
oracle_version = None oracle_version = None