Kaydet (Commit) c47364ef authored tarafından Claude Paroz's avatar Claude Paroz

Fixed #26134 -- Used new OpenGIS names for recent MySQL

Thanks František Malina for the report.
üst 9a5c9458
......@@ -11,12 +11,27 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
mysql = True
name = 'mysql'
select = 'AsText(%s)'
from_wkb = 'GeomFromWKB'
from_text = 'GeomFromText'
Adapter = WKTAdapter
@cached_property
def select(self):
if self.connection.mysql_version < (5, 6, 0):
return 'AsText(%s)'
return 'ST_AsText(%s)'
@cached_property
def from_wkb(self):
if self.connection.mysql_version < (5, 6, 0):
return 'GeomFromWKB'
return 'ST_GeomFromWKB'
@cached_property
def from_text(self):
if self.connection.mysql_version < (5, 6, 0):
return 'GeomFromText'
return 'ST_GeomFromText'
gis_operators = {
'bbcontains': SpatialOperator(func='MBRContains'), # For consistency w/PostGIS API
'bboverlaps': SpatialOperator(func='MBROverlaps'), # .. ..
......@@ -32,11 +47,13 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
'within': SpatialOperator(func='MBRWithin'),
}
function_names = {
@cached_property
def function_names(self):
return {
'Difference': 'ST_Difference',
'Distance': 'ST_Distance',
'Intersection': 'ST_Intersection',
'Length': 'GLength',
'Length': 'GLength' if self.connection.mysql_version < (5, 6, 0) else 'ST_Length',
'SymDifference': 'ST_SymDifference',
'Union': 'ST_Union',
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment