Add PC_Version function to read library version

This commit is contained in:
Paul Ramsey 2013-05-08 11:17:19 -07:00
parent 379f22f24a
commit 26b44326ee
4 changed files with 24 additions and 0 deletions

View File

@ -1,4 +1,10 @@
CREATE EXTENSION pointcloud;
SELECT PC_Version();
pc_version
------------
1.0
(1 row)
INSERT INTO pointcloud_formats (pcid, srid, schema)
VALUES (1, 0,
'<?xml version="1.0" encoding="UTF-8"?>

View File

@ -23,6 +23,7 @@ Datum pcpatch_compression(PG_FUNCTION_ARGS);
Datum pcpatch_intersects(PG_FUNCTION_ARGS);
Datum pcpatch_size(PG_FUNCTION_ARGS);
Datum pcpoint_size(PG_FUNCTION_ARGS);
Datum pc_version(PG_FUNCTION_ARGS);
/* Generic aggregation functions */
Datum pointcloud_agg_transfn(PG_FUNCTION_ARGS);
@ -575,3 +576,13 @@ Datum pcpoint_size(PG_FUNCTION_ARGS)
PG_RETURN_INT32(VARSIZE(serpt));
}
PG_FUNCTION_INFO_V1(pc_version);
Datum pc_version(PG_FUNCTION_ARGS)
{
text *version_text;
char version[64];
snprintf(version, 64, "%s", POINTCLOUD_VERSION);
version_text = cstring_to_text(version);
PG_RETURN_TEXT_P(version_text);
}

View File

@ -46,6 +46,11 @@ CREATE OR REPLACE FUNCTION pc_typmod_pcid(typmod integer)
RETURNS int4 AS 'MODULE_PATHNAME','pc_typmod_pcid'
LANGUAGE 'c' IMMUTABLE STRICT;
-- Return the library version number
CREATE OR REPLACE FUNCTION pc_version()
RETURNS text AS 'MODULE_PATHNAME', 'pc_version'
LANGUAGE 'c' IMMUTABLE STRICT;
-------------------------------------------------------------------
-- PCPOINT
-------------------------------------------------------------------

View File

@ -1,5 +1,7 @@
CREATE EXTENSION pointcloud;
SELECT PC_Version();
INSERT INTO pointcloud_formats (pcid, srid, schema)
VALUES (1, 0,
'<?xml version="1.0" encoding="UTF-8"?>