1SPI_CURSOR_OPEN_WITH_ARGS(P3o)stgreSQL 14.3 DocumentatSiPoIn_CURSOR_OPEN_WITH_ARGS(3)
2
3
4

NAME

6       SPI_cursor_open_with_args - set up a cursor using a query and
7       parameters
8

SYNOPSIS

10       Portal SPI_cursor_open_with_args(const char *name,
11                                        const char *command,
12                                        int nargs, Oid *argtypes,
13                                        Datum *values, const char *nulls,
14                                        bool read_only, int cursorOptions)
15

DESCRIPTION

17       SPI_cursor_open_with_args sets up a cursor (internally, a portal) that
18       will execute the specified query. Most of the parameters have the same
19       meanings as the corresponding parameters to SPI_prepare_cursor and
20       SPI_cursor_open.
21
22       For one-time query execution, this function should be preferred over
23       SPI_prepare_cursor followed by SPI_cursor_open. If the same command is
24       to be executed with many different parameters, either method might be
25       faster, depending on the cost of re-planning versus the benefit of
26       custom plans.
27
28       The passed-in parameter data will be copied into the cursor's portal,
29       so it can be freed while the cursor still exists.
30
31       This function is now deprecated in favor of SPI_cursor_parse_open,
32       which provides equivalent functionality using a more modern API for
33       handling query parameters.
34

ARGUMENTS

36       const char * name
37           name for portal, or NULL to let the system select a name
38
39       const char * command
40           command string
41
42       int nargs
43           number of input parameters ($1, $2, etc.)
44
45       Oid * argtypes
46           an array of length nargs, containing the OIDs of the data types of
47           the parameters
48
49       Datum * values
50           an array of length nargs, containing the actual parameter values
51
52       const char * nulls
53           an array of length nargs, describing which parameters are null
54
55           If nulls is NULL then SPI_cursor_open_with_args assumes that no
56           parameters are null. Otherwise, each entry of the nulls array
57           should be ' ' if the corresponding parameter value is non-null, or
58           'n' if the corresponding parameter value is null. (In the latter
59           case, the actual value in the corresponding values entry doesn't
60           matter.) Note that nulls is not a text string, just an array: it
61           does not need a '\0' terminator.
62
63       bool read_only
64           true for read-only execution
65
66       int cursorOptions
67           integer bit mask of cursor options; zero produces default behavior
68

RETURN VALUE

70       Pointer to portal containing the cursor. Note there is no error return
71       convention; any error will be reported via elog.
72
73
74
75PostgreSQL 14.3                      2022         SPI_CURSOR_OPEN_WITH_ARGS(3)
Impressum