Kaynağa Gözat

Fixed #23145 -- Dropped support for Oracle < 11.1

Tim Graham 10 yıl önce
ebeveyn
işleme
8f9d6e83a0

+ 2 - 24
django/db/backends/oracle/base.py

@@ -359,22 +359,13 @@ WHEN (new.%(col_name)s IS NULL)
     def random_function_sql(self):
         return "DBMS_RANDOM.RANDOM"
 
-    def regex_lookup_9(self, lookup_type):
-        raise NotImplementedError("Regexes are not supported in Oracle before version 10g.")
-
-    def regex_lookup_10(self, lookup_type):
+    def regex_lookup(self, lookup_type):
         if lookup_type == 'regex':
             match_option = "'c'"
         else:
             match_option = "'i'"
         return 'REGEXP_LIKE(%%s, %%s, %s)' % match_option
 
-    def regex_lookup(self, lookup_type):
-        # If regex_lookup is called before it's been initialized, then create
-        # a cursor to initialize it and recur.
-        with self.connection.cursor():
-            return self.connection.ops.regex_lookup(lookup_type)
-
     def return_insert_id(self):
         return "RETURNING %s INTO %%s", (InsertIdVar(),)
 
@@ -646,15 +637,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
                 self.operators = self._standard_operators
             cursor.close()
 
-        # There's no way for the DatabaseOperations class to know the
-        # currently active Oracle version, so we do some setups here.
-        # TODO: Multi-db support will need a better solution (a way to
-        # communicate the current version).
-        if self.oracle_version is not None and self.oracle_version <= 9:
-            self.ops.regex_lookup = self.ops.regex_lookup_9
-        else:
-            self.ops.regex_lookup = self.ops.regex_lookup_10
-
         try:
             self.connection.stmtcachesize = 20
         except AttributeError:
@@ -713,11 +695,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
 
     def is_usable(self):
         try:
-            if hasattr(self.connection, 'ping'):    # Oracle 10g R2 and higher
-                self.connection.ping()
-            else:
-                # Use a cx_Oracle cursor directly, bypassing Django's utilities.
-                self.connection.cursor().execute("SELECT 1 FROM DUAL")
+            self.connection.ping()
         except Database.Error:
             return False
         else:

+ 1 - 1
docs/ref/contrib/gis/install/index.txt

@@ -63,7 +63,7 @@ Database            Library Requirements            Supported Versions  Notes
 ==================  ==============================  ==================  =========================================
 PostgreSQL          GEOS, PROJ.4, PostGIS           9.0+                Requires PostGIS.
 MySQL               GEOS                            5.x                 Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`.
-Oracle              GEOS                            10.2, 11            XE not supported; not tested with 9.
+Oracle              GEOS                            11.1+               XE not supported.
 SQLite              GEOS, GDAL, PROJ.4, SpatiaLite  3.6.+               Requires SpatiaLite 2.3+, pysqlite2 2.5+
 ==================  ==============================  ==================  =========================================
 

+ 3 - 4
docs/ref/databases.txt

@@ -695,10 +695,9 @@ you add quotes where necessary before copying a query into an SQLite shell.
 Oracle notes
 ============
 
-Django supports `Oracle Database Server`_ versions 9i and
-higher. Oracle version 10g or later is required to use Django's
-``regex`` and ``iregex`` query operators. You will also need at least
-version 4.3.1 of the `cx_Oracle`_ Python driver.
+Django supports `Oracle Database Server`_ versions 11.1 and higher. Version
+4.3.1 or higher of the `cx_Oracle`_ Python driver is required, although we
+recommend version 5.1.3 or later as these versions support Python 3.
 
 Note that due to a Unicode-corruption bug in ``cx_Oracle`` 5.0, that
 version of the driver should **not** be used with Django;

+ 7 - 0
docs/releases/1.8.txt

@@ -407,6 +407,13 @@ officially supports.
 This also includes dropping support for PostGIS 1.3 and 1.4 as these versions
 are not supported on versions of PostgreSQL later than 8.4.
 
+Support for Oracle versions older than 11.1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The end of upstream support periods was reached in July 2010 for Oracle 9.2,
+January 2012 for Oracle 10.1, and July 2013 for Oracle 10.2. As a consequence,
+Django 1.8 sets 11.1 as the minimum Oracle version it officially supports.
+
 ``AbstractUser.last_login`` allows null values
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~