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.

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

13 {
14  dTHX;
15  bool in = PG_GETARG_BOOL(0);
16 
17  return PointerGetDatum(in ? &PL_sv_yes : &PL_sv_no);
18 }
#define dTHX
Definition: ppport.h:3208
#define PointerGetDatum(X)
Definition: postgres.h:556
#define PG_GETARG_BOOL(n)
Definition: fmgr.h:274
#define PL_sv_yes
Definition: ppport.h:4130
#define PL_sv_no
Definition: ppport.h:4128

◆ PG_FUNCTION_INFO_V1() [1/2]

PG_FUNCTION_INFO_V1 ( bool_to_plperl  )

Referenced by 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.

References dTHX, PG_GETARG_POINTER, and PG_RETURN_BOOL.

Referenced by bool_to_plperl().

25 {
26  dTHX;
27  SV *in = (SV *) PG_GETARG_POINTER(0);
28 
29  PG_RETURN_BOOL(SvTRUE(in));
30 }
#define dTHX
Definition: ppport.h:3208
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359

Variable Documentation

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 7 of file bool_plperl.c.