aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plperl/SPI.xs
blob: ee0d602269389dda6afd388baf4502d425e18a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* this must be first: */
#include "postgres.h"

/* perl stuff */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "spi_internal.h"



MODULE = SPI PREFIX = spi_

PROTOTYPES: ENABLE
VERSIONCHECK: DISABLE

void
spi_elog(level, message)
	int level
	char* message
	CODE:
	elog(level, message);


int
spi_DEBUG()

int
spi_LOG()

int
spi_INFO()

int
spi_NOTICE()

int
spi_WARNING()

int
spi_ERROR()

SV*
spi_spi_exec_query(query, ...)
	char* query;
	PREINIT:
		HV *ret_hash;
		int limit=0;
	CODE:
			if (items>2) Perl_croak(aTHX_ "Usage: spi_exec_query(query, limit) or spi_exec_query(query)");
			if (items == 2) limit = SvIV(ST(1));
			ret_hash=plperl_spi_exec(query, limit);
		RETVAL = newRV_noinc((SV*)ret_hash);
	OUTPUT:
		RETVAL