PostgreSQL Source Code git master
bool_plperl.c File Reference
#include "postgres.h"
#include "fmgr.h"
#include "plperl.h"
Include dependency graph for bool_plperl.c:

Go to the source code of this file.

Functions

 PG_MODULE_MAGIC_EXT (.name="bool_plperl",.version=PG_VERSION)
 
 PG_FUNCTION_INFO_V1 (bool_to_plperl)
 
Datum bool_to_plperl (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (plperl_to_bool)
 
Datum plperl_to_bool (PG_FUNCTION_ARGS)
 

Function Documentation

◆ bool_to_plperl()

Datum bool_to_plperl ( PG_FUNCTION_ARGS  )

Definition at line 15 of file bool_plperl.c.

16{
17 dTHX;
18 bool in = PG_GETARG_BOOL(0);
19
20 return PointerGetDatum(in ? &PL_sv_yes : &PL_sv_no);
21}
#define PG_GETARG_BOOL(n)
Definition: fmgr.h:274
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:327
#define PL_sv_yes
Definition: ppport.h:11781
#define dTHX
Definition: ppport.h:11306
#define PL_sv_no
Definition: ppport.h:11779

References dTHX, PG_GETARG_BOOL, PL_sv_no, PL_sv_yes, and PointerGetDatum().

◆ PG_FUNCTION_INFO_V1() [1/2]

PG_FUNCTION_INFO_V1 ( bool_to_plperl  )

◆ PG_FUNCTION_INFO_V1() [2/2]

PG_FUNCTION_INFO_V1 ( plperl_to_bool  )

◆ PG_MODULE_MAGIC_EXT()

PG_MODULE_MAGIC_EXT ( name = "bool_plperl",
version = PG_VERSION 
)

◆ plperl_to_bool()

Datum plperl_to_bool ( PG_FUNCTION_ARGS  )

Definition at line 27 of file bool_plperl.c.

28{
29 dTHX;
30 SV *in = (SV *) PG_GETARG_POINTER(0);
31
32 PG_RETURN_BOOL(SvTRUE(in));
33}
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359

References dTHX, PG_GETARG_POINTER, and PG_RETURN_BOOL.