summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoulder Sprinters <boulder-sprinters@djangoproject.com>2007-03-16 06:34:03 +0000
committerBoulder Sprinters <boulder-sprinters@djangoproject.com>2007-03-16 06:34:03 +0000
commit881c07cf2e212e04b2a8be47f444c6da56b5f382 (patch)
treed3ba5865c8789d968e07f24fcdbac216a5be0662
parent945c4ddf2474c7b1732619c205b074d4ccc0ad95 (diff)
downloaddjango-881c07cf2e212e04b2a8be47f444c6da56b5f382.tar.gz
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
-rw-r--r--django/db/backends/ado_mssql/base.py1
-rw-r--r--django/db/backends/mysql/base.py1
-rw-r--r--django/db/backends/oracle/base.py15
-rw-r--r--django/db/backends/postgresql/base.py1
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py1
-rw-r--r--django/db/backends/sqlite3/base.py1
-rw-r--r--django/db/models/query.py8
7 files changed, 16 insertions, 12 deletions
diff --git a/django/db/backends/ado_mssql/base.py b/django/db/backends/ado_mssql/base.py
index 34fafe444c..220331480b 100644
--- a/django/db/backends/ado_mssql/base.py
+++ b/django/db/backends/ado_mssql/base.py
@@ -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
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index 5301816ec9..c635e58cba 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -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
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 20aed3feee..fd8c8dde14 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -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 '\\'",
}
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index 58b6189545..340fd54710 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -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
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index dd586f454e..654b31c6b8 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -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
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index f933c6d3cb..f2e602e17d 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -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
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 87571bcce6..b92cf4e04e 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -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':