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 
8 
10 
11 Datum
13 {
14  dTHX;
15  bool in = PG_GETARG_BOOL(0);
16 
17  return PointerGetDatum(in ? &PL_sv_yes : &PL_sv_no);
18 }
19 
20 
22 
23 Datum
25 {
26  dTHX;
27  SV *in = (SV *) PG_GETARG_POINTER(0);
28 
29  PG_RETURN_BOOL(SvTRUE(in));
30 }
PG_FUNCTION_INFO_V1(bool_to_plperl)
PG_MODULE_MAGIC
Definition: bool_plperl.c:7
Datum bool_to_plperl(PG_FUNCTION_ARGS)
Definition: bool_plperl.c:12
Datum plperl_to_bool(PG_FUNCTION_ARGS)
Definition: bool_plperl.c:24
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
#define PG_GETARG_BOOL(n)
Definition: fmgr.h:274
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
uintptr_t Datum
Definition: postgres.h:64
#define PL_sv_yes
Definition: ppport.h:11781
#define dTHX
Definition: ppport.h:11306
#define PL_sv_no
Definition: ppport.h:11779