1SPI_CURSOR_OPEN_WITH_ARGS(P3o)stgreSQL 12.2 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

ARGUMENTS

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

RETURN VALUE

66       Pointer to portal containing the cursor. Note there is no error return
67       convention; any error will be reported via elog.
68
69
70
71PostgreSQL 12.2                      2020         SPI_CURSOR_OPEN_WITH_ARGS(3)
Impressum