From: Sandro Santilli Date: Wed, 7 Mar 2012 11:18:07 +0000 (+0000) Subject: Report libjson availability from postgis_full_version (#1660) X-Git-Tag: 2.0.0beta2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8df69f55cd6ee192f5a672cea607c1b8dd403814;p=postgis Report libjson availability from postgis_full_version (#1660) This commit adds a postgis_libjson_version() although the library doesn't give any version information. We just return NULL if not using the library and "UNKNOWN" otherwise. git-svn-id: http://svn.osgeo.org/postgis/trunk@9418 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_in_geojson.c b/postgis/lwgeom_in_geojson.c index b2bd76d78..1f2fcdb1f 100644 --- a/postgis/lwgeom_in_geojson.c +++ b/postgis/lwgeom_in_geojson.c @@ -463,6 +463,18 @@ parse_geojson(json_object *geojson, bool *hasz, int *root_srid) } #endif /* HAVE_LIBJSON */ +PG_FUNCTION_INFO_V1(postgis_libjson_version); +Datum postgis_libjson_version(PG_FUNCTION_ARGS) +{ +#ifndef HAVE_LIBJSON + PG_RETURN_NULL(); +#else /* HAVE_LIBJSON */ + const char *ver = "UNKNOWN"; + text *result = cstring2text(ver); + PG_RETURN_POINTER(result); +#endif +} + PG_FUNCTION_INFO_V1(geom_from_geojson); Datum geom_from_geojson(PG_FUNCTION_ARGS) { diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index bd5d9e03d..abd84361d 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -2359,10 +2359,12 @@ DECLARE rast_lib_ver text; rast_scr_ver text; topo_scr_ver text; + json_lib_ver text; BEGIN SELECT postgis_lib_version() INTO libver; SELECT postgis_proj_version() INTO projver; SELECT postgis_geos_version() INTO geosver; + SELECT postgis_libjson_version() INTO json_lib_ver; BEGIN SELECT postgis_gdal_version() INTO gdalver; EXCEPTION @@ -2422,6 +2424,10 @@ BEGIN fullver = fullver || ' LIBXML="' || libxmlver || '"'; END IF; + IF json_lib_ver IS NOT NULL THEN + fullver = fullver || ' LIBJSON="' || json_lib_ver || '"'; + END IF; + -- fullver = fullver || ' DBPROC="' || dbproc || '"'; -- fullver = fullver || ' RELPROC="' || relproc || '"'; @@ -3375,6 +3381,12 @@ CREATE OR REPLACE FUNCTION ST_GeomFromGeoJson(text) AS 'MODULE_PATHNAME','geom_from_geojson' LANGUAGE 'C' IMMUTABLE STRICT; +-- Availability: 2.0.0 +CREATE OR REPLACE FUNCTION postgis_libjson_version() + RETURNS text + AS 'MODULE_PATHNAME','postgis_libjson_version' + LANGUAGE 'C' IMMUTABLE STRICT; + ----------------------------------------------------------------------- -- SVG OUTPUT -----------------------------------------------------------------------