5 Utilities
The bindings described in this section are provided by the specific
modules below, not by db or db/base.
5.1 Datetime Type Utilities
Converts between this library’s date and time values and SRFI 19’s
date values (see
srfi/19). SRFI dates store more
information than SQL dates and times, so converting a SQL time to a
SRFI date, for example, puts zeroes in the year, month, and day
fields.
Examples: |
| (tm:date 0 0 30 7 0 0 0 0) | | (tm:date 0 0 0 0 25 12 1980 0) | | (tm:date 0 0 0 0 1 1 1970 0) |
|
Returns the length of interval in seconds.
5.2 Geometric Types
The following structures and functions deal with geometric values
based on the OpenGIS (ISO 19125) model.
Note: Geometric columns defined using the PostGIS extension to
PostgreSQL are not directly supported. Instead, data should be
exchanged in the Well-Known Binary format; conversion of the following
structures to and from WKB format is supported by the
wkb->geometry and geometry->wkb functions.
Represents an OpenGIS Point.
Represents an OpenGIS LineString.
Represents an OpenGIS Polygon.
Represents an OpenGIS MultiPoint, a collection of points.
Represents an OpenGIS MultiLineString, a collection of line-strings.
Represents an OpenGIS MultiPolygon, a collection of polygons.
Represents an OpenGIS GeometryCollection, a collection of
arbitrary geometric values.
Returns
#t if
x is a
line-string
consisting of exactly two points (cf OpenGIS
Line);
#f
otherwise.
Returns
#t if
x is a
line-string whose
first and last points are equal (cf OpenGIS
LinearRing);
#f otherwise.
Returns the Well-Known Binary (WKB) encoding of the geometric value
g. The big-endian? argument determines the byte
order used (the WKB format includes byte-order markers, so a robust
client should accept either encoding).
Decodes the Well-Known Binary (WKB) representation of a geometric
value.
5.3 PostgreSQL-specific Types
The following structures represent certain of PostgreSQL’s built-in
geometric types that have no appropriate analogue in the OpenGIS
model: box, path, and circle. The point,
lseg, and polygon PostgreSQL built-in types are represented
using point, line-string (line?), and
polygon structures.
Note: PostgreSQL’s built-in geometric types are distinct from those
provided by the PostGIS extension library (see Geometric Types).