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

References elog, ERROR, and PLy_ResultType.

Referenced by PLy_init_plpy().

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

◆ PLy_result_new()

PyObject* PLy_result_new ( void  )

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

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