(self, compiler, connection, **extra_context)
| 482 | return super().as_sql(compiler, connection, **extra_context) |
| 483 | |
| 484 | def as_postgresql(self, compiler, connection, **extra_context): |
| 485 | clone = self.copy() |
| 486 | function = None |
| 487 | if self.source_is_geography(): |
| 488 | clone.source_expressions.append(Value(self.spheroid)) |
| 489 | elif self.geo_field.geodetic(connection): |
| 490 | # Geometry fields with geodetic (lon/lat) coordinates need |
| 491 | # length_spheroid |
| 492 | function = connection.ops.spatial_function_name("LengthSpheroid") |
| 493 | clone.source_expressions.append(Value(self.geo_field.spheroid(connection))) |
| 494 | else: |
| 495 | dim = min(f.dim for f in self.get_source_fields() if f) |
| 496 | if dim > 2: |
| 497 | function = connection.ops.length3d |
| 498 | return super(Length, clone).as_sql( |
| 499 | compiler, connection, function=function, **extra_context |
| 500 | ) |
| 501 | |
| 502 | def as_sqlite(self, compiler, connection, **extra_context): |
| 503 | function = None |
nothing calls this directly
no test coverage detected