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 65 of file plpy_resultobject.c.

References elog, ERROR, and PLy_ResultType.

Referenced by PLy_init_plpy().

66 {
67  if (PyType_Ready(&PLy_ResultType) < 0)
68  elog(ERROR, "could not initialize PLy_ResultType");
69 }
#define ERROR
Definition: elog.h:43
static PyTypeObject PLy_ResultType
#define elog(elevel,...)
Definition: elog.h:226

◆ PLy_result_new()

PyObject* PLy_result_new ( void  )

Definition at line 72 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().

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