1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

boulder-oracle-sprint: Fixed #3723 and the get_object_or_404 tests as a

result.  Thanks again to Ben Khoo for finding the bug.


git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4741 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Boulder Sprinters 2007-03-16 06:34:03 +00:00
parent 945c4ddf24
commit 881c07cf2e
7 changed files with 16 additions and 12 deletions

View File

@ -91,6 +91,7 @@ class DatabaseWrapper(local):
allows_group_by_ordinal = True
allows_unique_and_pk = True
needs_datetime_string_cast = True
needs_upper_for_iops = False
supports_constraints = True
uses_case_insensitive_names = False

View File

@ -126,6 +126,7 @@ class DatabaseWrapper(local):
allows_group_by_ordinal = True
allows_unique_and_pk = True
needs_datetime_string_cast = True # MySQLdb requires a typecast for dates
needs_upper_for_iops = False
supports_constraints = True
uses_case_insensitive_names = False

View File

@ -70,6 +70,7 @@ class DatabaseWrapper(local):
allows_group_by_ordinal = False
allows_unique_and_pk = False # Suppress UNIQUE/PK for Oracle (ORA-02259)
needs_datetime_string_cast = False
needs_upper_for_iops = True
supports_constraints = True
uses_case_insensitive_names = True
@ -226,12 +227,6 @@ def get_trigger_name(table):
name_length = get_max_name_length() - 3
return '%s_TR' % util.truncate_name(table, name_length).upper()
def get_create_sequence(table):
return 'CREATE SEQUENCE %s;' % get_sequence_name(table)
def get_drop_sequence(table):
return 'DROP SEQUENCE %s;' % get_sequence_name(table)
def get_query_set_class(DefaultQuerySet):
"Create a custom QuerySet class for Oracle."
@ -429,15 +424,15 @@ def get_query_set_class(DefaultQuerySet):
OPERATOR_MAPPING = {
'exact': '= %s',
'iexact': "LIKE %s ESCAPE '\\'",
'iexact': '= UPPER(%s)',
'contains': "LIKE %s ESCAPE '\\'",
'icontains': "LIKE LOWER(%s) ESCAPE '\\'",
'icontains': "LIKE UPPER(%s) ESCAPE '\\'",
'gt': '> %s',
'gte': '>= %s',
'lt': '< %s',
'lte': '<= %s',
'startswith': "LIKE %s ESCAPE '\\'",
'endswith': "LIKE %s ESCAPE '\\'",
'istartswith': "LIKE %s ESCAPE '\\'",
'iendswith': "LIKE %s ESCAPE '\\'",
'istartswith': "LIKE UPPER(%s) ESCAPE '\\'",
'iendswith': "LIKE UPPER(%s) ESCAPE '\\'",
}

View File

@ -107,6 +107,7 @@ class DatabaseWrapper(local):
allows_group_by_ordinal = True
allows_unique_and_pk = True
needs_datetime_string_cast = True
needs_upper_for_iops = False
supports_constraints = True
uses_case_insensitive_names = False

View File

@ -75,6 +75,7 @@ class DatabaseWrapper(local):
allows_group_by_ordinal = True
allows_unique_and_pk = True
needs_datetime_string_cast = False
needs_upper_for_iops = False
supports_constraints = True
uses_case_insensitive_names = True

View File

@ -102,6 +102,7 @@ class SQLiteCursorWrapper(Database.Cursor):
allows_group_by_ordinal = True
allows_unique_and_pk = True
needs_datetime_string_cast = True
needs_upper_for_iops = False
supports_constraints = False
uses_case_insensitive_names = False

View File

@ -733,9 +733,13 @@ def get_where_clause(lookup_type, table_prefix, field_name, value):
cast_sql = backend.get_datetime_cast_sql()
else:
cast_sql = '%s'
if lookup_type in ('iexact', 'icontains', 'istartswith', 'iendswith') and backend.needs_upper_for_iops:
format = 'UPPER(%s%s) %s'
else:
format = '%s%s %s'
try:
return '%s%s %s' % (table_prefix, field_name,
backend.OPERATOR_MAPPING[lookup_type] % cast_sql)
return format % (table_prefix, field_name,
backend.OPERATOR_MAPPING[lookup_type] % cast_sql)
except KeyError:
pass
if lookup_type == 'in':