MCPcopy
hub / github.com/django/django / getquoted

Method getquoted

django/contrib/gis/db/backends/postgis/adapter.py:51–63  ·  view source on GitHub ↗

Return a properly quoted string for use in PostgreSQL/PostGIS.

(self)

Source from the content-addressed store, hash-verified

49 return poly
50
51 def getquoted(self):
52 """
53 Return a properly quoted string for use in PostgreSQL/PostGIS.
54 """
55 if self.is_geometry:
56 # Psycopg will figure out whether to use E'\\000' or '\000'.
57 return b"%s(%s)" % (
58 b"ST_GeogFromWKB" if self.geography else b"ST_GeomFromEWKB",
59 sql.quote(self.ewkb).encode(),
60 )
61 else:
62 # For rasters, add explicit type cast to WKB string.
63 return b"'%s'::raster" % self.ewkb.hex().encode()

Callers 2

__str__Method · 0.95
quote_lexemeFunction · 0.45

Calls 2

encodeMethod · 0.45
hexMethod · 0.45

Tested by

no test coverage detected