1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed Oracle GIS failures introduced by e9103402c0; refs #18757.

Thanks Marc Tamlyn for the patch.
This commit is contained in:
Tim Graham 2014-09-18 15:44:37 -04:00
parent 47ff469057
commit 185ab9ffef
3 changed files with 14 additions and 2 deletions

View File

@ -142,6 +142,17 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
truncate_params = {'relate': None}
def get_db_converters(self, internal_type):
converters = super(OracleOperations, self).get_db_converters(internal_type)
geometry_fields = (
'PointField', 'GeometryField', 'LineStringField',
'PolygonField', 'MultiPointField', 'MultiLineStringField',
'MultiPolygonField', 'GeometryCollectionField', 'GeomField',
)
if internal_type in geometry_fields:
converters.append(self.convert_textfield_value)
return converters
def convert_extent(self, clob):
if clob:
# Generally, Oracle returns a polygon for the extent -- however,

View File

@ -198,7 +198,7 @@ class GeometryField(Field):
return geom
def from_db_value(self, value, connection):
if value is not None:
if value:
value = Geometry(value)
return value

View File

@ -152,7 +152,8 @@ class GeoSQLCompiler(compiler.SQLCompiler):
for i, alias in enumerate(self.query.extra_select):
field = self.query.extra_select_fields.get(alias)
if field:
converters[i] = ([], [field.from_db_value], field)
backend_converters = self.connection.ops.get_db_converters(field.get_internal_type())
converters[i] = (backend_converters, [field.from_db_value], field)
return converters
#### Routines unique to GeoQuery ####