Loading django/contrib/gis/db/backends/mysql/operations.py +28 −11 Original line number Diff line number Diff line Loading @@ -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'), # .. .. Loading @@ -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', } Loading Loading
django/contrib/gis/db/backends/mysql/operations.py +28 −11 Original line number Diff line number Diff line Loading @@ -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'), # .. .. Loading @@ -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', } Loading