PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <limits.h>
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "executor/spi.h"
#include "mb/pg_wchar.h"
#include "parser/parse_type.h"
#include "plpy_elog.h"
#include "plpy_main.h"
#include "plpy_planobject.h"
#include "plpy_plpymodule.h"
#include "plpy_resultobject.h"
#include "plpy_spi.h"
#include "plpython.h"
#include "utils/memutils.h"
Go to the source code of this file.
Functions | |
static PyObject * | PLy_spi_execute_query (char *query, long limit) |
static PyObject * | PLy_spi_execute_fetch_result (SPITupleTable *tuptable, uint64 rows, int status) |
static void | PLy_spi_exception_set (PyObject *excclass, ErrorData *edata) |
PyObject * | PLy_spi_prepare (PyObject *self, PyObject *args) |
PyObject * | PLy_spi_execute (PyObject *self, PyObject *args) |
PyObject * | PLy_spi_execute_plan (PyObject *ob, PyObject *list, long limit) |
PyObject * | PLy_commit (PyObject *self, PyObject *args) |
PyObject * | PLy_rollback (PyObject *self, PyObject *args) |
void | PLy_spi_subtransaction_begin (MemoryContext oldcontext, ResourceOwner oldowner) |
void | PLy_spi_subtransaction_commit (MemoryContext oldcontext, ResourceOwner oldowner) |
void | PLy_spi_subtransaction_abort (MemoryContext oldcontext, ResourceOwner oldowner) |
PyObject* PLy_commit | ( | PyObject * | self, |
PyObject * | args | ||
) |
Definition at line 455 of file plpy_spi.c.
References CopyErrorData(), CurrentMemoryContext, PLyExceptionEntry::exc, FlushErrorState(), FreeErrorData(), HASH_FIND, hash_search(), MemoryContextSwitchTo(), PG_CATCH, PG_END_TRY, PG_TRY, PLy_current_execution_context(), PLy_exc_spi_error, PLy_spi_exception_set(), PLy_spi_exceptions, PLyExecutionContext::scratch_ctx, SPI_commit(), and ErrorData::sqlerrcode.
PyObject* PLy_rollback | ( | PyObject * | self, |
PyObject * | args | ||
) |
Definition at line 502 of file plpy_spi.c.
References CopyErrorData(), CurrentMemoryContext, PLyExceptionEntry::exc, FlushErrorState(), FreeErrorData(), HASH_FIND, hash_search(), MemoryContextSwitchTo(), PG_CATCH, PG_END_TRY, PG_TRY, PLy_current_execution_context(), PLy_exc_spi_error, PLy_spi_exception_set(), PLy_spi_exceptions, PLyExecutionContext::scratch_ctx, SPI_rollback(), and ErrorData::sqlerrcode.
|
static |
Definition at line 626 of file plpy_spi.c.
References generate_unaccent_rules::args, ErrorData::column_name, ErrorData::constraint_name, ErrorData::datatype_name, ErrorData::detail, elog, ERROR, ErrorData::hint, ErrorData::internalpos, ErrorData::internalquery, ErrorData::message, ErrorData::schema_name, ErrorData::sqlerrcode, and ErrorData::table_name.
Referenced by PLy_commit(), PLy_rollback(), and PLy_spi_subtransaction_abort().
PyObject* PLy_spi_execute | ( | PyObject * | self, |
PyObject * | args | ||
) |
Definition at line 151 of file plpy_spi.c.
References generate_unaccent_rules::args, is_PLyPlanObject(), sort-test::list, plan, PLy_exc_error, PLy_exception_set(), PLy_spi_execute_plan(), and PLy_spi_execute_query().
|
static |
Definition at line 345 of file plpy_spi.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CreateTupleDescCopy(), PLyExecutionContext::curr_proc, CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, i, MemoryContextDelete(), MemoryContextSwitchTo(), PLyResultObject::nrows, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, PLy_current_execution_context(), PLy_input_from_tuple(), PLy_input_setup_func(), PLy_input_setup_tuple(), PLy_result_new(), PLyResultObject::rows, SPI_freetuptable(), PLyResultObject::status, TopMemoryContext, SPITupleTable::tupdesc, PLyResultObject::tupdesc, and SPITupleTable::vals.
Referenced by PLy_spi_execute_plan(), and PLy_spi_execute_query().
PyObject* PLy_spi_execute_plan | ( | PyObject * | ob, |
PyObject * | list, | ||
long | limit | ||
) |
Definition at line 172 of file plpy_spi.c.
References arg, PLyExecutionContext::curr_proc, CurrentMemoryContext, CurrentResourceOwner, DatumGetPointer(), ERROR, PLyProcedure::fn_readonly, i, j, sort-test::list, palloc(), pfree(), PG_CATCH, PG_END_TRY, PG_FINALLY, PG_TRY, plan, PLy_current_execution_context(), PLy_elog, PLy_exc_spi_error, PLy_exception_set(), PLy_exception_set_plural(), PLy_output_convert(), PLy_spi_execute_fetch_result(), PLy_spi_subtransaction_abort(), PLy_spi_subtransaction_begin(), PLy_spi_subtransaction_commit(), PLyUnicode_AsString(), PointerGetDatum(), SPI_execute_plan(), SPI_processed, SPI_result_code_string(), and SPI_tuptable.
Referenced by PLy_plan_execute(), and PLy_spi_execute().
|
static |
Definition at line 303 of file plpy_spi.c.
References PLyExecutionContext::curr_proc, CurrentMemoryContext, CurrentResourceOwner, PLyProcedure::fn_readonly, PG_CATCH, PG_END_TRY, PG_TRY, pg_verifymbstr(), PLy_current_execution_context(), PLy_exc_spi_error, PLy_exception_set(), PLy_spi_execute_fetch_result(), PLy_spi_subtransaction_abort(), PLy_spi_subtransaction_begin(), PLy_spi_subtransaction_commit(), SPI_execute(), SPI_processed, SPI_result_code_string(), and SPI_tuptable.
Referenced by PLy_spi_execute().
PyObject* PLy_spi_prepare | ( | PyObject * | self, |
PyObject * | args | ||
) |
Definition at line 36 of file plpy_spi.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, generate_unaccent_rules::args, Assert, PLyExecutionContext::curr_proc, CurrentMemoryContext, CurrentResourceOwner, elog, ereport, errmsg(), ERROR, i, sort-test::list, MemoryContextSwitchTo(), palloc0(), parseTypeString(), PG_CATCH, PG_END_TRY, PG_TRY, pg_verifymbstr(), plan, PLy_current_execution_context(), PLy_exception_set(), PLy_output_setup_func(), PLy_plan_new(), PLy_spi_subtransaction_abort(), PLy_spi_subtransaction_begin(), PLy_spi_subtransaction_commit(), PLyUnicode_AsString(), SPI_keepplan(), SPI_prepare(), SPI_result, SPI_result_code_string(), and TopMemoryContext.
void PLy_spi_subtransaction_abort | ( | MemoryContext | oldcontext, |
ResourceOwner | oldowner | ||
) |
Definition at line 591 of file plpy_spi.c.
References CopyErrorData(), CurrentResourceOwner, PLyExceptionEntry::exc, FlushErrorState(), FreeErrorData(), HASH_FIND, hash_search(), MemoryContextSwitchTo(), PLy_exc_spi_error, PLy_spi_exception_set(), PLy_spi_exceptions, RollbackAndReleaseCurrentSubTransaction(), and ErrorData::sqlerrcode.
Referenced by PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_cursor_plan(), PLy_cursor_query(), PLy_spi_execute_plan(), PLy_spi_execute_query(), and PLy_spi_prepare().
void PLy_spi_subtransaction_begin | ( | MemoryContext | oldcontext, |
ResourceOwner | oldowner | ||
) |
Definition at line 574 of file plpy_spi.c.
References BeginInternalSubTransaction(), and MemoryContextSwitchTo().
Referenced by PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_cursor_plan(), PLy_cursor_query(), PLy_spi_execute_plan(), PLy_spi_execute_query(), and PLy_spi_prepare().
void PLy_spi_subtransaction_commit | ( | MemoryContext | oldcontext, |
ResourceOwner | oldowner | ||
) |
Definition at line 582 of file plpy_spi.c.
References CurrentResourceOwner, MemoryContextSwitchTo(), and ReleaseCurrentSubTransaction().
Referenced by PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_cursor_plan(), PLy_cursor_query(), PLy_spi_execute_plan(), PLy_spi_execute_query(), and PLy_spi_prepare().