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 157 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().

158 {
159  PyObject *main_mod,
160  *main_dict,
161  *plpy_mod;
162 
163 #if PY_MAJOR_VERSION < 3
164  PyObject *plpy;
165 #endif
166 
167  /*
168  * initialize plpy module
169  */
174 
175 #if PY_MAJOR_VERSION >= 3
176  PyModule_Create(&PLy_module);
177  /* for Python 3 we initialized the exceptions in PyInit_plpy */
178 #else
179  plpy = Py_InitModule("plpy", PLy_methods);
180  PLy_add_exceptions(plpy);
181 #endif
182 
183  /* PyDict_SetItemString(plpy, "PlanType", (PyObject *) &PLy_PlanType); */
184 
185  /*
186  * initialize main module, and add plpy
187  */
188  main_mod = PyImport_AddModule("__main__");
189  main_dict = PyModule_GetDict(main_mod);
190  plpy_mod = PyImport_AddModule("plpy");
191  if (plpy_mod == NULL)
192  PLy_elog(ERROR, "could not import \"plpy\" module");
193  PyDict_SetItemString(main_dict, "plpy", plpy_mod);
194  if (PyErr_Occurred())
195  PLy_elog(ERROR, "could not import \"plpy\" module");
196 }
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 27 of file plpy_plpymodule.c.

Referenced by PLy_spi_subtransaction_abort().