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_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)
 

Variables

 PG_MODULE_MAGIC
 

Function Documentation

◆ bool_to_plperl()

Datum bool_to_plperl ( PG_FUNCTION_ARGS  )

Definition at line 12 of file bool_plperl.c.

13 {
14  dTHX;
15  bool in = PG_GETARG_BOOL(0);
16 
17  return PointerGetDatum(in ? &PL_sv_yes : &PL_sv_no);
18 }
#define PG_GETARG_BOOL(n)
Definition: fmgr.h:274
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
#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  )

◆ plperl_to_bool()

Datum plperl_to_bool ( PG_FUNCTION_ARGS  )

Definition at line 24 of file bool_plperl.c.

25 {
26  dTHX;
27  SV *in = (SV *) PG_GETARG_POINTER(0);
28 
29  PG_RETURN_BOOL(SvTRUE(in));
30 }
#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.

Variable Documentation

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 7 of file bool_plperl.c.