PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
plpy_resultobject.h File Reference
#include "access/tupdesc.h"
#include "plpython.h"
Include dependency graph for plpy_resultobject.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PLyResultObject
 

Typedefs

typedef struct PLyResultObject PLyResultObject
 

Functions

void PLy_result_init_type (void)
 
PyObject * PLy_result_new (void)
 

Typedef Documentation

◆ PLyResultObject

Function Documentation

◆ PLy_result_init_type()

void PLy_result_init_type ( void  )

Definition at line 81 of file plpy_resultobject.c.

82{
83 PLy_ResultType = (PyTypeObject *) PyType_FromSpec(&PLyResult_spec);
84 if (!PLy_ResultType)
85 elog(ERROR, "could not initialize PLy_ResultType");
86}
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
static PyType_Spec PLyResult_spec
static PyTypeObject * PLy_ResultType

References elog, ERROR, PLy_ResultType, and PLyResult_spec.

Referenced by PLy_init_plpy().

◆ PLy_result_new()

PyObject * PLy_result_new ( void  )

Definition at line 89 of file plpy_resultobject.c.

90{
92
93 if ((ob = PyObject_New(PLyResultObject, PLy_ResultType)) == NULL)
94 return NULL;
95#if PY_VERSION_HEX < 0x03080000
96 /* Workaround for Python issue 35810; no longer necessary in Python 3.8 */
97 Py_INCREF(PLy_ResultType);
98#endif
99
100 /* ob->tuples = NULL; */
101
102 Py_INCREF(Py_None);
103 ob->status = Py_None;
104 ob->nrows = PyLong_FromLong(-1);
105 ob->rows = PyList_New(0);
106 ob->tupdesc = NULL;
107 if (!ob->rows)
108 {
109 Py_DECREF(ob);
110 return NULL;
111 }
112
113 return (PyObject *) ob;
114}
PyObject_HEAD PyObject * nrows

References PLyResultObject::nrows, PLy_ResultType, PLyResultObject::rows, PLyResultObject::status, and PLyResultObject::tupdesc.

Referenced by PLy_cursor_fetch(), and PLy_spi_execute_fetch_result().