summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/backends/oracle/base.py5
-rw-r--r--django/db/models/sql/where.py2
2 files changed, 7 insertions, 0 deletions
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 4093b69be6..76e5743539 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -400,6 +400,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'istartswith': "LIKE UPPER(%s) ESCAPE '\\'",
'iendswith': "LIKE UPPER(%s) ESCAPE '\\'",
}
+ oracle_version = None
def _valid_connection(self):
return self.connection is not None
@@ -414,6 +415,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
else:
conn_string = "%s/%s@%s" % (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)
self.connection = Database.connect(conn_string, **self.options)
+ try:
+ self.oracle_version = int(self.connection.version.split('.')[0])
+ except ValueError:
+ pass
cursor = FormatStylePlaceholderCursor(self.connection)
# Default arraysize of 1 is highly sub-optimal.
cursor.arraysize = 100
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 527ce833fc..c2215105c3 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -131,6 +131,8 @@ class WhereNode(tree.Node):
elif lookup_type in ('regex', 'iregex'):
# FIXME: Factor this out in to conn.ops
if settings.DATABASE_ENGINE == 'oracle':
+ if connection.oracle_version and connection.oracle_version <= 9:
+ raise NotImplementedError("Regexes are not supported in Oracle before version 10g.")
if lookup_type == 'regex':
match_option = 'c'
else: