Add xid_to_int4() function for Postgres.
This commit is contained in:
parent
b3ff342e6b
commit
7b632da44a
2 changed files with 35 additions and 2 deletions
|
@ -15,8 +15,8 @@ clean:
|
|||
libmyosm.so: quadtile-mysql.o maptile-mysql.o
|
||||
cc ${LDFLAGS} -o libmyosm.so quadtile-mysql.o maptile-mysql.o
|
||||
|
||||
libpgosm.so: quadtile-pgsql.o maptile-pgsql.o
|
||||
cc ${LDFLAGS} -o libpgosm.so quadtile-pgsql.o maptile-pgsql.o
|
||||
libpgosm.so: quadtile-pgsql.o maptile-pgsql.o xid_to_int4-pgsql.o
|
||||
cc ${LDFLAGS} -o libpgosm.so quadtile-pgsql.o maptile-pgsql.o xid_to_int4-pgsql.o
|
||||
|
||||
quadtile-mysql.o: quadtile.c ${QTDIR}/quad_tile.h
|
||||
cc `mysql_config --include` -I${QTDIR} -fPIC -O3 -DUSE_MYSQL -c -o quadtile-mysql.o quadtile.c
|
||||
|
@ -29,3 +29,6 @@ maptile-mysql.o: maptile.c
|
|||
|
||||
maptile-pgsql.o: maptile.c
|
||||
cc -I `pg_config --includedir-server` -fPIC -O3 -DUSE_PGSQL -c -o maptile-pgsql.o maptile.c
|
||||
|
||||
xid_to_int4-pgsql.o: xid_to_int4.c
|
||||
cc -I `pg_config --includedir-server` -fPIC -O3 -DUSE_PGSQL -c -o xid_to_int4-pgsql.o xid_to_int4.c
|
||||
|
|
30
db/functions/xid_to_int4.c
Normal file
30
db/functions/xid_to_int4.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef USE_MYSQL
|
||||
#ifndef USE_PGSQL
|
||||
#error One of USE_MYSQL or USE_PGSQL must be defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_PGSQL
|
||||
#ifdef USE_MYSQL
|
||||
#error ONLY one of USE_MYSQL and USE_PGSQL should be defined
|
||||
#endif
|
||||
|
||||
#include <postgres.h>
|
||||
#include <fmgr.h>
|
||||
|
||||
int xid_to_int4(TransactionId xid)
|
||||
{
|
||||
return xid;
|
||||
}
|
||||
|
||||
/*
|
||||
* To bind this into PGSQL, try something like:
|
||||
*
|
||||
* CREATE FUNCTION xid_to_int4(xid) RETURNS int4
|
||||
* AS '/path/to/rails-port/db/functions/libpgosm', 'xid_to_int4'
|
||||
* LANGUAGE C IMMUTABLE STRICT;
|
||||
*
|
||||
* (without all the *s)
|
||||
*/
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue