PostgreSQL Source Code
git master
bool_plperl.c
Go to the documentation of this file.
1
#include "
postgres.h
"
2
3
#include "
fmgr.h
"
4
#include "
plperl.h
"
5
6
7
PG_MODULE_MAGIC
;
8
9
PG_FUNCTION_INFO_V1
(
bool_to_plperl
);
10
11
Datum
12
bool_to_plperl
(
PG_FUNCTION_ARGS
)
13
{
14
dTHX
;
15
bool
in =
PG_GETARG_BOOL
(0);
16
17
return
PointerGetDatum
(in ? &
PL_sv_yes
: &
PL_sv_no
);
18
}
19
20
21
PG_FUNCTION_INFO_V1
(
plperl_to_bool
);
22
23
Datum
24
plperl_to_bool
(
PG_FUNCTION_ARGS
)
25
{
26
dTHX
;
27
SV *in = (SV *)
PG_GETARG_POINTER
(0);
28
29
PG_RETURN_BOOL
(SvTRUE(in));
30
}
PG_FUNCTION_INFO_V1
PG_FUNCTION_INFO_V1(bool_to_plperl)
PG_MODULE_MAGIC
PG_MODULE_MAGIC
Definition:
bool_plperl.c:7
bool_to_plperl
Datum bool_to_plperl(PG_FUNCTION_ARGS)
Definition:
bool_plperl.c:12
plperl_to_bool
Datum plperl_to_bool(PG_FUNCTION_ARGS)
Definition:
bool_plperl.c:24
fmgr.h
PG_GETARG_POINTER
#define PG_GETARG_POINTER(n)
Definition:
fmgr.h:276
PG_GETARG_BOOL
#define PG_GETARG_BOOL(n)
Definition:
fmgr.h:274
PG_FUNCTION_ARGS
#define PG_FUNCTION_ARGS
Definition:
fmgr.h:193
PG_RETURN_BOOL
#define PG_RETURN_BOOL(x)
Definition:
fmgr.h:359
plperl.h
postgres.h
PointerGetDatum
static Datum PointerGetDatum(const void *X)
Definition:
postgres.h:322
Datum
uintptr_t Datum
Definition:
postgres.h:64
PL_sv_yes
#define PL_sv_yes
Definition:
ppport.h:11781
dTHX
#define dTHX
Definition:
ppport.h:11306
PL_sv_no
#define PL_sv_no
Definition:
ppport.h:11779
contrib
bool_plperl
bool_plperl.c
Generated on Thu Dec 12 2024 18:13:14 for PostgreSQL Source Code by
1.9.1