73 elog(
ERROR,
"could not initialize PLy_CursorType");
106#if PY_VERSION_HEX < 0x03080000
113 "PL/Python cursor context",
143 elog(
ERROR,
"SPI_cursor_open() failed: %s",
187 if (nargs !=
plan->nargs)
196 "Expected sequence of %d argument, got %d: %s",
197 "Expected sequence of %d arguments, got %d: %s",
207#if PY_VERSION_HEX < 0x03080000
214 "PL/Python cursor context",
232 char *
volatile nulls;
240 "PL/Python temporary context",
247 nulls = (
char *)
palloc(nargs *
sizeof(
char));
255 for (
j = 0;
j < nargs;
j++)
266 nulls[
j] = isnull ?
'n' :
' ';
280 elog(
ERROR,
"SPI_cursor_open() failed: %s",
306#if PY_VERSION_HEX >= 0x03080000
329#if PY_VERSION_HEX >= 0x03080000
357 "iterating a cursor in an aborted subtransaction");
423 "iterating a cursor in an aborted subtransaction");
458 errmsg(
"query result has too many rows to fit in a Python list")));
510 "closing a cursor in an aborted subtransaction");
static Datum values[MAXATTR]
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool pg_verifymbstr(const char *mbstr, int len, bool noError)
char * MemoryContextStrdup(MemoryContext context, const char *string)
MemoryContext TopMemoryContext
MemoryContext CurTransactionContext
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define ALLOCSET_SMALL_SIZES
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static PyType_Spec PLyCursor_spec
PyObject * PLy_cursor(PyObject *self, PyObject *args)
PyObject * PLy_cursor_plan(PyObject *ob, PyObject *args)
static PyMethodDef PLy_cursor_methods[]
static PyObject * PLy_cursor_query(const char *query)
static PyObject * PLy_cursor_fetch(PyObject *self, PyObject *args)
static PyObject * PLy_cursor_iternext(PyObject *self)
static PyObject * PLy_cursor_close(PyObject *self, PyObject *unused)
static PyTypeObject * PLy_CursorType
static PyType_Slot PLyCursor_slots[]
static void PLy_cursor_dealloc(PLyCursorObject *self)
void PLy_cursor_init_type(void)
static const char PLy_cursor_doc[]
void PLy_exception_set(PyObject *exc, const char *fmt,...)
void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
PLyExecutionContext * PLy_current_execution_context(void)
PyObject * PLy_result_new(void)
void PLy_spi_subtransaction_commit(MemoryContext oldcontext, ResourceOwner oldowner)
void PLy_spi_subtransaction_abort(MemoryContext oldcontext, ResourceOwner oldowner)
void PLy_spi_subtransaction_begin(MemoryContext oldcontext, ResourceOwner oldowner)
void PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt, Oid typeOid, int32 typmod, PLyProcedure *proc)
PyObject * PLy_input_from_tuple(PLyDatumToOb *arg, HeapTuple tuple, TupleDesc desc, bool include_generated)
void PLy_input_setup_tuple(PLyDatumToOb *arg, TupleDesc desc, PLyProcedure *proc)
Datum PLy_output_convert(PLyObToDatum *arg, PyObject *val, bool *isnull)
char * PLyUnicode_AsString(PyObject *unicode)
void PinPortal(Portal portal)
void UnpinPortal(Portal portal)
Portal GetPortalByName(const char *name)
ResourceOwner CurrentResourceOwner
int SPI_freeplan(SPIPlanPtr plan)
const char * SPI_result_code_string(int code)
SPITupleTable * SPI_tuptable
Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, const Datum *Values, const char *Nulls, bool read_only)
void SPI_cursor_fetch(Portal portal, bool forward, long count)
void SPI_freetuptable(SPITupleTable *tuptable)
SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes)
void SPI_cursor_close(Portal portal)
PyObject_HEAD char * portalname
PyObject_HEAD PyObject * nrows