blob: 0fa1eee8e57ebf921a8a5a1446f3cdc749db1d38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "postgres.h"
#include "fmgr.h"
#include "plperl.h"
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(bool_to_plperl);
Datum
bool_to_plperl(PG_FUNCTION_ARGS)
{
dTHX;
bool in = PG_GETARG_BOOL(0);
return PointerGetDatum(in ? &PL_sv_yes : &PL_sv_no);
}
PG_FUNCTION_INFO_V1(plperl_to_bool);
Datum
plperl_to_bool(PG_FUNCTION_ARGS)
{
dTHX;
SV *in = (SV *) PG_GETARG_POINTER(0);
PG_RETURN_BOOL(SvTRUE(in));
}
|