mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #19198 -- merged 4 different Oracle fixes
This commit is contained in:
@@ -26,7 +26,7 @@ mysql = _default_db == 'mysql'
|
||||
spatialite = _default_db == 'spatialite'
|
||||
|
||||
HAS_SPATIALREFSYS = True
|
||||
if oracle:
|
||||
if oracle and 'gis' in settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE']:
|
||||
from django.contrib.gis.db.backends.oracle.models import SpatialRefSys
|
||||
elif postgis:
|
||||
from django.contrib.gis.db.backends.postgis.models import SpatialRefSys
|
||||
|
||||
@@ -256,6 +256,10 @@ WHEN (new.%(col_name)s IS NULL)
|
||||
if not name.startswith('"') and not name.endswith('"'):
|
||||
name = '"%s"' % util.truncate_name(name.upper(),
|
||||
self.max_name_length())
|
||||
# Oracle puts the query text into a (query % args) construct, so % signs
|
||||
# in names need to be escaped. The '%%' will be collapsed back to '%' at
|
||||
# that stage so we aren't really making the name longer here.
|
||||
name = name.replace('%','%%')
|
||||
return name.upper()
|
||||
|
||||
def random_function_sql(self):
|
||||
|
||||
@@ -1418,8 +1418,15 @@ def get_cached_row(row, index_start, using, klass_info, offset=0):
|
||||
fields = row[index_start : index_start + field_count]
|
||||
# If all the select_related columns are None, then the related
|
||||
# object must be non-existent - set the relation to None.
|
||||
# Otherwise, construct the related object.
|
||||
if fields == (None,) * field_count:
|
||||
# Otherwise, construct the related object. Also, some backends treat ''
|
||||
# and None equivalently for char fields, so we have to be prepared for
|
||||
# '' values.
|
||||
if connections[using].features.interprets_empty_strings_as_nulls:
|
||||
vals = tuple([None if f == '' else f for f in fields])
|
||||
else:
|
||||
vals = fields
|
||||
|
||||
if vals == (None,) * field_count:
|
||||
obj = None
|
||||
else:
|
||||
if field_names:
|
||||
|
||||
Reference in New Issue
Block a user