SPI_cursor_parse_open_with_paramlist

SPI_cursor_parse_open_with_paramlist — set up a cursor using a query and parameters

Synopsis

Portal SPI_cursor_parse_open_with_paramlist(const char *name,
                                            const char *command,
                                            ParamListInfo params,
                                            bool read_only,
                                            int cursorOptions)

Description

SPI_cursor_parse_open_with_paramlist sets up a cursor (internally, a portal) that will execute the specified query. This function is equivalent to SPI_cursor_open_with_args except that any parameters referenced by the query are provided by a ParamListInfo object, rather than in ad-hoc arrays.

The params object should normally mark each parameter with the PARAM_FLAG_CONST flag, since a one-shot plan is always used for the query.

The passed-in parameter data will be copied into the cursor's portal, so it can be freed while the cursor still exists.

Arguments

const char * name

name for portal, or NULL to let the system select a name

const char * command

command string

ParamListInfo params

data structure containing parameter types and values; NULL if none

bool read_only

true for read-only execution

int cursorOptions

integer bit mask of cursor options; zero produces default behavior

Return Value

Pointer to portal containing the cursor. Note there is no error return convention; any error will be reported via elog.