PostgreSQL Source Code git master
Loading...
Searching...
No Matches
ltree_plpython.c File Reference
#include "postgres.h"
#include "fmgr.h"
#include "ltree/ltree.h"
#include "plpy_util.h"
Include dependency graph for ltree_plpython.c:

Go to the source code of this file.

Macros

#define PLyUnicode_FromStringAndSize   PLyUnicode_FromStringAndSize_p
 

Typedefs

typedef PyObject *(* PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size)
 

Functions

 PG_MODULE_MAGIC_EXT (.name="ltree_plpython",.version=PG_VERSION)
 
void _PG_init (void)
 
 PG_FUNCTION_INFO_V1 (ltree_to_plpython)
 
Datum ltree_to_plpython (PG_FUNCTION_ARGS)
 

Variables

static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p
 
StaticAssertVariableIsOfTypePLyUnicode_FromStringAndSize
 

Macro Definition Documentation

◆ PLyUnicode_FromStringAndSize

#define PLyUnicode_FromStringAndSize   PLyUnicode_FromStringAndSize_p

Definition at line 33 of file ltree_plpython.c.

Typedef Documentation

◆ PLyUnicode_FromStringAndSize_t

typedef PyObject *(* PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size)

Definition at line 13 of file ltree_plpython.c.

Function Documentation

◆ _PG_init()

void _PG_init ( void  )

Definition at line 24 of file ltree_plpython.c.

25{
27 load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize",
28 true, NULL);
29}
void * load_external_function(const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
Definition dfmgr.c:95
PyObject *(* PLyUnicode_FromStringAndSize_t)(const char *s, Py_ssize_t size)
static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p
static int fb(int x)

References fb(), load_external_function(), and PLyUnicode_FromStringAndSize_p.

◆ ltree_to_plpython()

Datum ltree_to_plpython ( PG_FUNCTION_ARGS  )

Definition at line 39 of file ltree_plpython.c.

40{
41 ltree *in = PG_GETARG_LTREE_P(0);
42 int i;
45
47 if (!list)
50 errmsg("out of memory")));
51
53 for (i = 0; i < in->numlevel; i++)
54 {
57 }
58
59 PG_FREE_IF_COPY(in, 0);
60
61 return PointerGetDatum(list);
62}
int errcode(int sqlerrcode)
Definition elog.c:863
int errmsg(const char *fmt,...)
Definition elog.c:1080
#define ERROR
Definition elog.h:39
#define ereport(elevel,...)
Definition elog.h:150
#define PG_FREE_IF_COPY(ptr, n)
Definition fmgr.h:260
int i
Definition isn.c:77
#define LTREE_FIRST(x)
Definition ltree.h:51
#define LEVEL_NEXT(x)
Definition ltree.h:40
#define PG_GETARG_LTREE_P(n)
Definition ltree.h:221
#define PLyUnicode_FromStringAndSize
static Datum PointerGetDatum(const void *X)
Definition postgres.h:352
Definition ltree.h:43
uint16 numlevel
Definition ltree.h:45

References ereport, errcode(), errmsg(), ERROR, fb(), i, LEVEL_NEXT, LTREE_FIRST, ltree::numlevel, PG_FREE_IF_COPY, PG_GETARG_LTREE_P, PLyUnicode_FromStringAndSize, and PointerGetDatum().

◆ PG_FUNCTION_INFO_V1()

PG_FUNCTION_INFO_V1 ( ltree_to_plpython  )

◆ PG_MODULE_MAGIC_EXT()

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

Variable Documentation

◆ PLyUnicode_FromStringAndSize

StaticAssertVariableIsOfType& PLyUnicode_FromStringAndSize

Definition at line 17 of file ltree_plpython.c.

◆ PLyUnicode_FromStringAndSize_p

PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p
static

Definition at line 14 of file ltree_plpython.c.

Referenced by _PG_init().