Fixed Oracle GIS gml() test failure introduced by e910340; refs #18757.

This commit is contained in:
Marc Tamlyn 2014-09-21 08:51:59 +01:00
parent c9a53035d6
commit c6fd1e904c
4 changed files with 18 additions and 3 deletions

View File

@ -148,6 +148,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
'PointField', 'GeometryField', 'LineStringField',
'PolygonField', 'MultiPointField', 'MultiLineStringField',
'MultiPolygonField', 'GeometryCollectionField', 'GeomField',
'GMLField',
)
if internal_type in geometry_fields:
converters.append(self.convert_textfield_value)

View File

@ -3,7 +3,7 @@ from django.db.models.query import QuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, PointField, LineStringField
from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery
from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery, GMLField
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
@ -175,6 +175,8 @@ class GeoQuerySet(QuerySet):
if backend.postgis:
s['procedure_fmt'] = '%(version)s,%(geo_col)s,%(precision)s'
s['procedure_args'] = {'precision': precision, 'version': version}
if backend.oracle:
s['select_field'] = GMLField()
return self._spatial_attribute('gml', s, **kwargs)

View File

@ -1,6 +1,6 @@
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField, GMLField
from django.contrib.gis.db.models.sql.query import GeoQuery
__all__ = [
'AreaField', 'DistanceField', 'GeomField', 'GeoQuery',
'AreaField', 'DistanceField', 'GeomField', 'GMLField', 'GeoQuery',
]

View File

@ -51,3 +51,15 @@ class GeomField(BaseField):
def get_internal_type(self):
return 'GeometryField'
class GMLField(BaseField):
"""
Wrapper for GML to be used by Oracle to ensure Database.LOB conversion.
"""
def get_internal_type(self):
return 'GMLField'
def from_db_value(self, value, connection):
return value