Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit472b209

Browse files
authored
Merge pull request#23 from vitcpp/10-pgsphere-version
[ISSUE-10] Implemented propagation of pg sphere version.
2 parents001cee8 +894f9bb commit472b209

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

‎Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ TESTS = init_test tables points euler circle line ellipse poly path box in
3232
contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
3333
moc mocautocast epochprop
3434

35+
PG_CFLAGS+= -DPGSPHERE_VERSION=$(PGSPHERE_VERSION)
36+
PG_CPPFLAGS+= -DPGSPHERE_VERSION=$(PGSPHERE_VERSION)
37+
3538
ifndefCXXFLAGS
3639
# no support for CXXFLAGS in PGXS before v11
3740
CXXFLAGS = -Wall -Wpointer-arith -Wendif-labels\

‎expected/init.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
-- does not depend on contents of pg_sphere.sql.
44
--
55
CREATE EXTENSION pg_sphere;
6+
select pg_sphere_version();
7+
pg_sphere_version
8+
-------------------
9+
1.2.1
10+
(1 row)
11+

‎sql/init.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
-- does not depend on contents of pg_sphere.sql.
44
--
55
CREATE EXTENSION pg_sphere;
6+
7+
select pg_sphere_version();

‎src/output.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#include"types.h"
22

3+
#if !defined(PGSPHERE_VERSION)
4+
#error "PGSPHERE_VERSION macro is not set"
5+
#endif
6+
7+
#definePGSPHERE_STRINGIFY_INTERNAL(x) #x
8+
#definePGSPHERE_STRINGIFY(x) PGSPHERE_STRINGIFY_INTERNAL(x)
9+
310
/* Output functions */
411

512

@@ -527,7 +534,8 @@ spherebox_out(PG_FUNCTION_ARGS)
527534
Datum
528535
pg_sphere_version(PG_FUNCTION_ARGS)
529536
{
530-
char*buffer= (char*)palloc(20);
531-
sprintf(buffer,"1.1.5");
532-
PG_RETURN_CSTRING(buffer);
537+
constchar*s=PGSPHERE_STRINGIFY(PGSPHERE_VERSION);
538+
char*p= (char*)palloc(strlen(s)+1);
539+
strcpy(p,s);
540+
PG_RETURN_CSTRING(p);
533541
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp