PostgreSQL Source Code  git master
plpy_plpymodule.h File Reference
#include "utils/hsearch.h"
Include dependency graph for plpy_plpymodule.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void PLy_init_plpy (void)
 

Variables

HTABPLy_spi_exceptions
 

Function Documentation

◆ PLy_init_plpy()

void PLy_init_plpy ( void  )

Definition at line 147 of file plpy_plpymodule.c.

References ERROR, PLy_add_exceptions(), PLy_cursor_init_type(), PLy_elog, PLy_methods, PLy_plan_init_type(), PLy_result_init_type(), and PLy_subtransaction_init_type().

Referenced by PLy_initialize().

148 {
149  PyObject *main_mod,
150  *main_dict,
151  *plpy_mod;
152 
153 #if PY_MAJOR_VERSION < 3
154  PyObject *plpy;
155 #endif
156 
157  /*
158  * initialize plpy module
159  */
164 
165 #if PY_MAJOR_VERSION >= 3
166  PyModule_Create(&PLy_module);
167  /* for Python 3 we initialized the exceptions in PyInit_plpy */
168 #else
169  plpy = Py_InitModule("plpy", PLy_methods);
170  PLy_add_exceptions(plpy);
171 #endif
172 
173  /* PyDict_SetItemString(plpy, "PlanType", (PyObject *) &PLy_PlanType); */
174 
175  /*
176  * initialize main module, and add plpy
177  */
178  main_mod = PyImport_AddModule("__main__");
179  main_dict = PyModule_GetDict(main_mod);
180  plpy_mod = PyImport_AddModule("plpy");
181  if (plpy_mod == NULL)
182  PLy_elog(ERROR, "could not import \"plpy\" module");
183  PyDict_SetItemString(main_dict, "plpy", plpy_mod);
184  if (PyErr_Occurred())
185  PLy_elog(ERROR, "could not import \"plpy\" module");
186 }
void PLy_plan_init_type(void)
static void PLy_add_exceptions(PyObject *plpy)
#define ERROR
Definition: elog.h:43
void PLy_cursor_init_type(void)
void PLy_subtransaction_init_type(void)
#define PLy_elog
void PLy_result_init_type(void)
static PyMethodDef PLy_methods[]

Variable Documentation

◆ PLy_spi_exceptions

HTAB* PLy_spi_exceptions

Definition at line 23 of file plpy_plpymodule.c.

Referenced by PLy_spi_subtransaction_abort().