PostgreSQL 9.0.17 Documentation
Prev | Up |  | Next

# SPI_prepare_cursor

## Name

SPI_prepare_cursor -- prepare a plan for a command, without executing it yet

## Synopsis

    SPIPlanPtr SPI_prepare_cursor(const char * command, int nargs,
                                  Oid * argtypes, int cursorOptions)

## Description

`SPI_prepare_cursor` is identical to `SPI_prepare`, except that it also allows specification of the planner's "cursor options" parameter. This is a bit mask having the values shown in `nodes/parsenodes.h` for the `options` field of `DeclareCursorStmt`. `SPI_prepare` always takes the cursor options as zero.

## Arguments

`const char * `command``

  command string

`int `nargs``

  number of input parameters (`$1`, `$2`, etc.)

`Oid * `argtypes``

  pointer to an array containing the OIDs of the data types of the parameters

`int `cursorOptions``

  integer bit mask of cursor options; zero produces default behavior

## Return Value

`SPI_prepare_cursor` has the same return conventions as `SPI_prepare`.

## Notes

Useful bits to set in `cursorOptions` include `CURSOR_OPT_SCROLL`, `CURSOR_OPT_NO_SCROLL`, and `CURSOR_OPT_FAST_PLAN`. Note in particular that `CURSOR_OPT_HOLD` is ignored.

Prev | Home | Next
SPI_prepare | Up | SPI_prepare_params