Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 881c07cf2e212e04b2a8be47f444c6da56b5f382 1 parent 945c4dd
Boulder Sprinters authored
1  django/db/backends/ado_mssql/base.py
View
@@ -91,6 +91,7 @@ def close(self):
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
1  django/db/backends/mysql/base.py
View
@@ -126,6 +126,7 @@ def get_server_version(self):
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
15 django/db/backends/oracle/base.py
View
@@ -70,6 +70,7 @@ def close(self):
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_sql_clause(self, get_full_query=False):
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 '\\'",
}
1  django/db/backends/postgresql/base.py
View
@@ -107,6 +107,7 @@ def close(self):
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
1  django/db/backends/postgresql_psycopg2/base.py
View
@@ -75,6 +75,7 @@ def close(self):
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
1  django/db/backends/sqlite3/base.py
View
@@ -102,6 +102,7 @@ def convert_query(self, query, num_params):
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
8 django/db/models/query.py
View
@@ -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':
Please sign in to comment.
Something went wrong with that request. Please try again.