PostgreSQL Source Code  git master
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 61 of file plpy_resultobject.c.

References elog, ERROR, and PLy_ResultType.

Referenced by PLy_init_plpy().

62 {
63  if (PyType_Ready(&PLy_ResultType) < 0)
64  elog(ERROR, "could not initialize PLy_ResultType");
65 }
#define ERROR
Definition: elog.h:43
static PyTypeObject PLy_ResultType
#define elog(elevel,...)
Definition: elog.h:214

◆ PLy_result_new()

PyObject* PLy_result_new ( void  )

Definition at line 68 of file plpy_resultobject.c.

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

Referenced by PLy_cursor_fetch(), and PLy_spi_execute_fetch_result().

69 {
70  PLyResultObject *ob;
71 
72  if ((ob = PyObject_New(PLyResultObject, &PLy_ResultType)) == NULL)
73  return NULL;
74 
75  /* ob->tuples = NULL; */
76 
77  Py_INCREF(Py_None);
78  ob->status = Py_None;
79  ob->nrows = PyInt_FromLong(-1);
80  ob->rows = PyList_New(0);
81  ob->tupdesc = NULL;
82  if (!ob->rows)
83  {
84  Py_DECREF(ob);
85  return NULL;
86  }
87 
88  return (PyObject *) ob;
89 }
static PyTypeObject PLy_ResultType
PyObject_HEAD PyObject * nrows