2 .\" Title: SPI_cursor_open_with_args
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "SPI_CURSOR_OPEN_WITH_ARGS" "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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 SPI_cursor_open_with_args \- set up a cursor using a query and parameters
35 Portal SPI_cursor_open_with_args(const char *\fIname\fR,
36 const char *\fIcommand\fR,
37 int \fInargs\fR, Oid *\fIargtypes\fR,
38 Datum *\fIvalues\fR, const char *\fInulls\fR,
39 bool \fIread_only\fR, int \fIcursorOptions\fR)
43 \fBSPI_cursor_open_with_args\fR
44 sets up a cursor (internally, a portal) that will execute the specified query\&. Most of the parameters have the same meanings as the corresponding parameters to
45 \fBSPI_prepare_cursor\fR
47 \fBSPI_cursor_open\fR\&.
49 For one\-time query execution, this function should be preferred over
50 \fBSPI_prepare_cursor\fR
52 \fBSPI_cursor_open\fR\&. If the same command is to be executed with many different parameters, either method might be faster, depending on the cost of re\-planning versus the benefit of custom plans\&.
54 The passed\-in parameter data will be copied into the cursor\*(Aqs portal, so it can be freed while the cursor still exists\&.
56 This function is now deprecated in favor of
57 \fBSPI_cursor_parse_open\fR, which provides equivalent functionality using a more modern API for handling query parameters\&.
60 const char * \fIname\fR
64 to let the system select a name
67 const char * \fIcommand\fR
74 number of input parameters ($1,
81 \fInargs\fR, containing the
82 OIDs of the data types of the parameters
88 \fInargs\fR, containing the actual parameter values
91 const char * \fInulls\fR
94 \fInargs\fR, describing which parameters are null
101 \fBSPI_cursor_open_with_args\fR
102 assumes that no parameters are null\&. Otherwise, each entry of the
106 if the corresponding parameter value is non\-null, or
108 if the corresponding parameter value is null\&. (In the latter case, the actual value in the corresponding
110 entry doesn\*(Aqt matter\&.) Note that
112 is not a text string, just an array: it does not need a
120 for read\-only execution
123 int \fIcursorOptions\fR
125 integer bit mask of cursor options; zero produces default behavior
129 Pointer to portal containing the cursor\&. Note there is no error return convention; any error will be reported via