PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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

void PLy_init_plpy ( void  )

Definition at line 146 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().

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

Variable Documentation

HTAB* PLy_spi_exceptions

Definition at line 24 of file plpy_plpymodule.c.

Referenced by PLy_spi_subtransaction_abort().