1
0
mirror of https://github.com/django/django.git synced 2025-07-06 10:49:17 +00:00

queryset-refactor: Merged to [6198]

git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-09-15 21:39:05 +00:00
parent d29c457ad1
commit ea9cd54213
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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: