MCPcopy Create free account
hub / github.com/apache/cloudberry / PLy_spi_execute

Function PLy_spi_execute

src/pl/plpython/plpy_spi.c:164–194  ·  view source on GitHub ↗

execute(query="select * from foo", limit=5) * execute(plan=plan, values=(foo, bar), limit=5) */

Source from the content-addressed store, hash-verified

162 * execute(plan=plan, values=(foo, bar), limit=5)
163 */
164PyObject *
165PLy_spi_execute(PyObject *self, PyObject *args)
166{
167 char *query;
168 PyObject *plan;
169 PyObject *list = NULL;
170 long limit = 0;
171 PyObject *ret;
172 PLy_enter_python_intepreter = false;
173
174 if (PyArg_ParseTuple(args, "s|l", &query, &limit))
175 {
176 ret = PLy_spi_execute_query(query, (int64)limit);
177 PLy_enter_python_intepreter = true;
178 return ret;
179 }
180
181 PyErr_Clear();
182
183 if (PyArg_ParseTuple(args, "O|Ol", &plan, &list, &limit) &&
184 is_PLyPlanObject(plan))
185 {
186 ret = PLy_spi_execute_plan(plan, list, (int64)limit);
187 PLy_enter_python_intepreter = true;
188 return ret;
189 }
190
191 PLy_exception_set(PLy_exc_error, "plpy.execute expected a query or a plan");
192 PLy_enter_python_intepreter = true;
193 return NULL;
194}
195
196PyObject *
197PLy_spi_execute_plan(PyObject *ob, PyObject *list, int64 limit)

Callers

nothing calls this directly

Calls 4

PLy_spi_execute_queryFunction · 0.85
is_PLyPlanObjectFunction · 0.85
PLy_spi_execute_planFunction · 0.85
PLy_exception_setFunction · 0.85

Tested by

no test coverage detected