Skip to content

Commit d245b6b

Browse files
committed
Document SPI_push() and SPI_pop().
1 parent c135205 commit d245b6b

File tree

3 files changed

+69
-5
lines changed

3 files changed

+69
-5
lines changed

doc/src/sgml/spi.sgml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.32 2004/03/05 01:00:45 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.33 2004/03/17 01:05:10 momjian Exp $
33
-->
44

55
<chapter id="spi">
@@ -199,6 +199,68 @@ int SPI_finish(void)
199199

200200
<!-- *********************************************** -->
201201

202+
<refentry id="spi-spi-push">
203+
<refmeta>
204+
<refentrytitle>SPI_push</refentrytitle>
205+
</refmeta>
206+
207+
<refnamediv>
208+
<refname>SPI_push</refname>
209+
<refpurpose>pushes SPI stack to allow recursive SPI calls</refpurpose>
210+
</refnamediv>
211+
212+
<indexterm><primary>SPI_push</primary></indexterm>
213+
214+
<refsynopsisdiv>
215+
<synopsis>
216+
void SPI_push(void)
217+
</synopsis>
218+
</refsynopsisdiv>
219+
220+
<refsect1>
221+
<title>Description</title>
222+
223+
<para>
224+
<function>SPI_push</function> pushes a new environment on to the
225+
SPI call stack, allowing recursive calls to use a new environment.
226+
</para>
227+
</refsect1>
228+
229+
</refentry>
230+
231+
<!-- *********************************************** -->
232+
233+
<refentry id="spi-spi-pop">
234+
<refmeta>
235+
<refentrytitle>SPI_pop</refentrytitle>
236+
</refmeta>
237+
238+
<refnamediv>
239+
<refname>SPI_pop</refname>
240+
<refpurpose>pops SPI stack to allow recursive SPI calls</refpurpose>
241+
</refnamediv>
242+
243+
<indexterm><primary>SPI_pop</primary></indexterm>
244+
245+
<refsynopsisdiv>
246+
<synopsis>
247+
void SPI_pop(void)
248+
</synopsis>
249+
</refsynopsisdiv>
250+
251+
<refsect1>
252+
<title>Description</title>
253+
254+
<para>
255+
<function>SPI_pop</function> pops the previous environment from the
256+
SPI call stack. For use when returning from recursive SPI calls.
257+
</para>
258+
</refsect1>
259+
260+
</refentry>
261+
262+
<!-- *********************************************** -->
263+
202264
<refentry id="spi-spi-exec">
203265
<refmeta>
204266
<refentrytitle>SPI_exec</refentrytitle>

src/backend/executor/spi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.110 2004/03/05 00:47:01 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.111 2004/03/17 01:05:10 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -201,12 +201,14 @@ AtEOXact_SPI(bool isCommit)
201201
SPI_tuptable = NULL;
202202
}
203203

204+
/* Pushes SPI stack to allow recursive SPI calls */
204205
void
205206
SPI_push(void)
206207
{
207208
_SPI_curid++;
208209
}
209210

211+
/* Pops SPI stack to allow recursive SPI calls */
210212
void
211213
SPI_pop(void)
212214
{

src/include/executor/spi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* spi.h
44
*
5-
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.42 2004/03/05 00:47:01 momjian Exp $
5+
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.43 2004/03/17 01:05:10 momjian Exp $
66
*
77
*-------------------------------------------------------------------------
88
*/
@@ -81,8 +81,8 @@ extern int SPI_connect(void);
8181
extern int SPI_finish(void);
8282
extern void SPI_push(void);
8383
extern void SPI_pop(void);
84-
extern int SPI_exec(const char *src, int tcount);
85-
extern int SPI_execp(void *plan, Datum *values, const char *Nulls,
84+
extern int SPI_exec(const char *src, int tcount);
85+
extern int SPI_execp(void *plan, Datum *values, const char *Nulls,
8686
int tcount);
8787
extern int SPI_execp_current(void *plan, Datum *values, const char *Nulls,
8888
bool useCurrentSnapshot, int tcount);

0 commit comments

Comments
 (0)