]> granicus.if.org Git - postgis/commitdiff
Report libjson availability from postgis_full_version (#1660)
authorSandro Santilli <strk@keybit.net>
Wed, 7 Mar 2012 11:18:07 +0000 (11:18 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 7 Mar 2012 11:18:07 +0000 (11:18 +0000)
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

postgis/lwgeom_in_geojson.c
postgis/postgis.sql.in.c

index b2bd76d78c98f3032005c3b85d11221bc058eb89..1f2fcdb1ff5e3a5c63eafabc8066288dea486c2c 100644 (file)
@@ -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)
 {
index bd5d9e03d31275d9925961a960d2f43f668dbfe3..abd84361da04b7aaf073eeaead0484a5f6015156 100644 (file)
@@ -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
 -----------------------------------------------------------------------