|
10 | 10 |
|
11 | 11 | #include"plpy_planobject.h"
|
12 | 12 |
|
| 13 | +#include"plpy_cursorobject.h" |
13 | 14 | #include"plpy_elog.h"
|
| 15 | +#include"plpy_spi.h" |
14 | 16 | #include"utils/memutils.h"
|
15 | 17 |
|
16 | 18 |
|
17 | 19 | staticvoidPLy_plan_dealloc(PyObject*arg);
|
| 20 | +staticPyObject*PLy_plan_cursor(PyObject*self,PyObject*args); |
| 21 | +staticPyObject*PLy_plan_execute(PyObject*self,PyObject*args); |
18 | 22 | staticPyObject*PLy_plan_status(PyObject*self,PyObject*args);
|
19 | 23 |
|
20 | 24 | staticcharPLy_plan_doc[]= {
|
21 | 25 | "Store a PostgreSQL plan"
|
22 | 26 | };
|
23 | 27 |
|
24 | 28 | staticPyMethodDefPLy_plan_methods[]= {
|
| 29 | +{"cursor",PLy_plan_cursor,METH_VARARGS,NULL}, |
| 30 | +{"execute",PLy_plan_execute,METH_VARARGS,NULL}, |
25 | 31 | {"status",PLy_plan_status,METH_VARARGS,NULL},
|
26 | 32 | {NULL,NULL,0,NULL}
|
27 | 33 | };
|
@@ -111,6 +117,31 @@ PLy_plan_dealloc(PyObject *arg)
|
111 | 117 | }
|
112 | 118 |
|
113 | 119 |
|
| 120 | +staticPyObject* |
| 121 | +PLy_plan_cursor(PyObject*self,PyObject*args) |
| 122 | +{ |
| 123 | +PyObject*planargs=NULL; |
| 124 | + |
| 125 | +if (!PyArg_ParseTuple(args,"|O",&planargs)) |
| 126 | +returnNULL; |
| 127 | + |
| 128 | +returnPLy_cursor_plan(self,planargs); |
| 129 | +} |
| 130 | + |
| 131 | + |
| 132 | +staticPyObject* |
| 133 | +PLy_plan_execute(PyObject*self,PyObject*args) |
| 134 | +{ |
| 135 | +PyObject*list=NULL; |
| 136 | +longlimit=0; |
| 137 | + |
| 138 | +if (!PyArg_ParseTuple(args,"|Ol",&list,&limit)) |
| 139 | +returnNULL; |
| 140 | + |
| 141 | +returnPLy_spi_execute_plan(self,list,limit); |
| 142 | +} |
| 143 | + |
| 144 | + |
114 | 145 | staticPyObject*
|
115 | 146 | PLy_plan_status(PyObject*self,PyObject*args)
|
116 | 147 | {
|
|