Skip to content

Commit 1732cb0

Browse files
committed
plperl update from Andrew Dunstan, deriving (I believe) from Command Prompt's
plperlNG. Review and minor cleanup/improvements by Joe Conway. Summary of new functionality: - Shared data space and namespace. There is a new global variable %_SHARED that functions can use to store and save data between invocations of a function, or between different functions. Also, all trusted plperl function now share a common Safe container (this is an optimization, also), which they can use for storing non-lexical variables, functions, etc. - Triggers are now supported - Records can now be returned (as a hash reference) - Sets of records can now be returned (as a reference to an array of hash references). - New function spi_exec_query() provided for performing db functions or getting data from db. - Optimization for counting hash keys (Abhijit Menon-Sen) - Allow return of 'record' and 'setof record'
1 parent b6197fe commit 1732cb0

File tree

7 files changed

+842
-99
lines changed

7 files changed

+842
-99
lines changed

src/pl/plperl/GNUmakefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile for PL/Perl
2-
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.12 2004/01/21 19:04:11 tgl Exp $
2+
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.13 2004/07/01 20:50:22 joe Exp $
33

44
subdir = src/pl/plperl
55
top_builddir = ../../..
@@ -25,8 +25,13 @@ NAME = plperl
2525
SO_MAJOR_VERSION = 0
2626
SO_MINOR_VERSION = 0
2727

28-
OBJS = plperl.o eloglvl.o SPI.o
28+
OBJS = plperl.o spi_internal.o SPI.o
29+
30+
ifeq ($(enable_rpath), yes)
31+
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS) -Wl,-rpath,$(perl_archlibexp)/CORE
32+
else
2933
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
34+
endif
3035

3136
include $(top_srcdir)/src/Makefile.shlib
3237

src/pl/plperl/SPI.xs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,51 @@
66
#include "perl.h"
77
#include "XSUB.h"
88

9-
#include "eloglvl.h"
9+
#include "spi_internal.h"
1010

1111

1212

13-
MODULE = SPI PREFIX = elog_
13+
MODULE = SPI PREFIX = spi_
1414

1515
PROTOTYPES: ENABLE
1616
VERSIONCHECK: DISABLE
1717

1818
void
19-
elog_elog(level, message)
19+
spi_elog(level, message)
2020
int level
2121
char* message
2222
CODE:
2323
elog(level, message);
2424

2525

2626
int
27-
elog_DEBUG()
27+
spi_DEBUG()
2828

2929
int
30-
elog_LOG()
30+
spi_LOG()
3131

3232
int
33-
elog_INFO()
33+
spi_INFO()
3434

3535
int
36-
elog_NOTICE()
36+
spi_NOTICE()
3737

3838
int
39-
elog_WARNING()
39+
spi_WARNING()
4040

4141
int
42-
elog_ERROR()
43-
44-
42+
spi_ERROR()
43+
44+
SV*
45+
spi_spi_exec_query(query, ...)
46+
char* query;
47+
PREINIT:
48+
HV *ret_hash;
49+
int limit=0;
50+
CODE:
51+
if (items>2) Perl_croak(aTHX_ "Usage: spi_exec_query(query, limit) or spi_exec_query(query)");
52+
if (items == 2) limit = SvIV(ST(1));
53+
ret_hash=plperl_spi_exec(query, limit);
54+
RETVAL = newRV_noinc((SV*)ret_hash);
55+
OUTPUT:
56+
RETVAL

src/pl/plperl/eloglvl.c

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/pl/plperl/eloglvl.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)