From 8484b440aeff6fae68bf74f0a05d1ad6eedbeaf8 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 28 Nov 2003 11:06:49 +0000 Subject: [PATCH] Added WKB_recv function for binary WKB input git-svn-id: http://svn.osgeo.org/postgis/trunk@394 b70326c6-7e19-0410-871a-916f4a2858ee --- Attic/postgis_sql_74_end.sql.in | 6 +++++- Attic/postgis_sql_74_start.sql.in | 8 ++++++++ postgis.h | 5 +++++ postgis_inout.c | 14 ++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Attic/postgis_sql_74_end.sql.in b/Attic/postgis_sql_74_end.sql.in index 5fdaf8040..bc872ba40 100644 --- a/Attic/postgis_sql_74_end.sql.in +++ b/Attic/postgis_sql_74_end.sql.in @@ -12,6 +12,9 @@ -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- $Log$ +-- Revision 1.3 2003/11/28 11:06:49 strk +-- Added WKB_recv function for binary WKB input +-- -- Revision 1.2 2003/11/19 15:29:21 strk -- Added default btree operator class for PG7.4 -- @@ -35,7 +38,8 @@ CREATE TYPE wkb ( input = wkb_in, output = wkb_out, storage = extended, - send = bytea + send = bytea, + receive = wkb_recv ); -- diff --git a/Attic/postgis_sql_74_start.sql.in b/Attic/postgis_sql_74_start.sql.in index a72811d3a..48b91bd1f 100644 --- a/Attic/postgis_sql_74_start.sql.in +++ b/Attic/postgis_sql_74_start.sql.in @@ -12,6 +12,9 @@ -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- $Log$ +-- Revision 1.2 2003/11/28 11:06:49 strk +-- Added WKB_recv function for binary WKB input +-- -- Revision 1.1 2003/11/11 10:38:23 strk -- Postgresql 7.4 enabler scripts. -- @@ -106,6 +109,11 @@ CREATE FUNCTION wkb_out(wkb) AS '@MODULE_FILENAME@','WKB_out' LANGUAGE 'C' WITH (isstrict); +CREATE FUNCTION wkb_recv(internal) + RETURNS wkb + AS '@MODULE_FILENAME@','WKB_recv' + LANGUAGE 'C' WITH (isstrict); + -- - - - - - - - - - - - - - - - - - - - - - - - - - - - -- CHIP diff --git a/postgis.h b/postgis.h index 06ea98334..fd94987d4 100644 --- a/postgis.h +++ b/postgis.h @@ -11,6 +11,9 @@ * ********************************************************************** * $Log$ + * Revision 1.39 2003/11/28 11:06:49 strk + * Added WKB_recv function for binary WKB input + * * Revision 1.38 2003/11/19 15:44:51 strk * added prototypes for geometry_{le,ge,cmp} * @@ -559,6 +562,8 @@ Datum postgis_gist_sel(PG_FUNCTION_ARGS); Datum WKB_in(PG_FUNCTION_ARGS); Datum WKB_out(PG_FUNCTION_ARGS); +Datum WKB_recv(PG_FUNCTION_ARGS); + Datum CHIP_in(PG_FUNCTION_ARGS); Datum CHIP_out(PG_FUNCTION_ARGS); Datum CHIP_to_geom(PG_FUNCTION_ARGS); diff --git a/postgis_inout.c b/postgis_inout.c index c7a160456..4d37d4b88 100644 --- a/postgis_inout.c +++ b/postgis_inout.c @@ -11,6 +11,9 @@ * ********************************************************************** * $Log$ + * Revision 1.29 2003/11/28 11:06:49 strk + * Added WKB_recv function for binary WKB input + * * Revision 1.28 2003/10/06 18:09:08 dblasby * Fixed typo in add_to_geometry(). With very poorly aligned sub-objects, it * wouldnt allocate enough memory. Fixed it so its pesimistic and will allocate @@ -3536,6 +3539,17 @@ Datum WKB_out(PG_FUNCTION_ARGS) } +PG_FUNCTION_INFO_V1(WKB_recv); +Datum WKB_recv(PG_FUNCTION_ARGS) +{ + bytea *in = (bytea *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); + WellKnownBinary *result; + + result = (WellKnownBinary *) palloc(in->vl_len); + memcpy(result, in, in->vl_len); + PG_RETURN_POINTER(result); +} + PG_FUNCTION_INFO_V1(WKBtoBYTEA); Datum WKBtoBYTEA(PG_FUNCTION_ARGS) { -- 2.40.0