]> begriffs open source - ai-pg/blob - full-docs/man3/SPI_execute_plan.3
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man3 / SPI_execute_plan.3
1 '\" t
2 .\"     Title: SPI_execute_plan
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "SPI_EXECUTE_PLAN" "3" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 SPI_execute_plan \- execute a statement prepared by \fBSPI_prepare\fR
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 int SPI_execute_plan(SPIPlanPtr \fIplan\fR, Datum * \fIvalues\fR, const char * \fInulls\fR,
36                      bool \fIread_only\fR, long \fIcount\fR)
37 .fi
38 .SH "DESCRIPTION"
39 .PP
40 \fBSPI_execute_plan\fR
41 executes a statement prepared by
42 \fBSPI_prepare\fR
43 or one of its siblings\&.
44 \fIread_only\fR
45 and
46 \fIcount\fR
47 have the same interpretation as in
48 \fBSPI_execute\fR\&.
49 .SH "ARGUMENTS"
50 .PP
51 SPIPlanPtr \fIplan\fR
52 .RS 4
53 prepared statement (returned by
54 \fBSPI_prepare\fR)
55 .RE
56 .PP
57 Datum * \fIvalues\fR
58 .RS 4
59 An array of actual parameter values\&. Must have same length as the statement\*(Aqs number of arguments\&.
60 .RE
61 .PP
62 const char * \fInulls\fR
63 .RS 4
64 An array describing which parameters are null\&. Must have same length as the statement\*(Aqs number of arguments\&.
65 .sp
66 If
67 \fInulls\fR
68 is
69 NULL
70 then
71 \fBSPI_execute_plan\fR
72 assumes that no parameters are null\&. Otherwise, each entry of the
73 \fInulls\fR
74 array should be
75 \*(Aq\ \&\*(Aq
76 if the corresponding parameter value is non\-null, or
77 \*(Aqn\*(Aq
78 if the corresponding parameter value is null\&. (In the latter case, the actual value in the corresponding
79 \fIvalues\fR
80 entry doesn\*(Aqt matter\&.) Note that
81 \fInulls\fR
82 is not a text string, just an array: it does not need a
83 \*(Aq\e0\*(Aq
84 terminator\&.
85 .RE
86 .PP
87 bool \fIread_only\fR
88 .RS 4
89 true
90 for read\-only execution
91 .RE
92 .PP
93 long \fIcount\fR
94 .RS 4
95 maximum number of rows to return, or
96 0
97 for no limit
98 .RE
99 .SH "RETURN VALUE"
100 .PP
101 The return value is the same as for
102 \fBSPI_execute\fR, with the following additional possible error (negative) results:
103 .PP
104 SPI_ERROR_ARGUMENT
105 .RS 4
106 if
107 \fIplan\fR
108 is
109 NULL
110 or invalid, or
111 \fIcount\fR
112 is less than 0
113 .RE
114 .PP
115 SPI_ERROR_PARAM
116 .RS 4
117 if
118 \fIvalues\fR
119 is
120 NULL
121 and
122 \fIplan\fR
123 was prepared with some parameters
124 .RE
125 .PP
126 \fISPI_processed\fR
127 and
128 \fISPI_tuptable\fR
129 are set as in
130 \fBSPI_execute\fR
131 if successful\&.