Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

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 143 of file plpy_plpymodule.c.

References ERROR, NULL, 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 _PG_init().

{
    PyObject   *main_mod,
               *main_dict,
               *plpy_mod;

#if PY_MAJOR_VERSION < 3
    PyObject   *plpy;
#endif

    /*
     * initialize plpy module
     */
    PLy_plan_init_type();
    PLy_result_init_type();
    PLy_subtransaction_init_type();
    PLy_cursor_init_type();

#if PY_MAJOR_VERSION >= 3
    PyModule_Create(&PLy_module);
    /* for Python 3 we initialized the exceptions in PyInit_plpy */
#else
    plpy = Py_InitModule("plpy", PLy_methods);
    PLy_add_exceptions(plpy);
#endif

    /* PyDict_SetItemString(plpy, "PlanType", (PyObject *) &PLy_PlanType); */

    /*
     * initialize main module, and add plpy
     */
    main_mod = PyImport_AddModule("__main__");
    main_dict = PyModule_GetDict(main_mod);
    plpy_mod = PyImport_AddModule("plpy");
    if (plpy_mod == NULL)
        PLy_elog(ERROR, "could not import \"plpy\" module");
    PyDict_SetItemString(main_dict, "plpy", plpy_mod);
    if (PyErr_Occurred())
        PLy_elog(ERROR, "could not import \"plpy\" module");
}


Variable Documentation

Definition at line 24 of file plpy_plpymodule.c.

Referenced by PLy_spi_subtransaction_abort().