SPI_prepare_cursor
SPI_prepare_cursor — подготовить оператор, но пока не выполнять его
Синтаксис
SPIPlanPtr SPI_prepare_cursor(const char *command, intnargs, Oid *argtypes, intcursorOptions)
Описание
Функция SPI_prepare_cursor равнозначна SPI_prepare, за исключением того, что ей можно передать «параметры курсора». Эти параметры задаются битовой маской со значениями, определёнными в nodes/parsenodes.h для поля options структуры DeclareCursorStmt. SPI_prepare подразумевает, что эти параметры всегда нулевые.
Эта функция устарела, используйте вместо неё SPI_prepare_extended.
Аргументы
const char *commandстрока команды
intnargsчисло входных параметров (
$1,$2и т. д.)Oid *argtypesуказатель на массив, содержащий OID типов параметров
intcursorOptionsбитовая маска параметров курсора; 0 выбирает поведение по умолчанию
Возвращаемое значение
SPI_prepare_cursor возвращает результат по тем же соглашениям, что и SPI_prepare.
Примечания
К числу полезных бит, которые можно задать в cursorOptions, относятся CURSOR_OPT_SCROLL, CURSOR_OPT_NO_SCROLL, CURSOR_OPT_FAST_PLAN, CURSOR_OPT_GENERIC_PLAN и CURSOR_OPT_CUSTOM_PLAN. Заметьте, что параметр CURSOR_OPT_HOLD игнорируется.
SPI_prepare_cursor
SPI_prepare_cursor — prepare a statement, without executing it yet
Synopsis
SPIPlanPtr SPI_prepare_cursor(const char *command, intnargs, Oid *argtypes, intcursorOptions)
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.
This function is now deprecated in favor of SPI_prepare_extended.
Arguments
const char *commandcommand string
intnargsnumber of input parameters (
$1,$2, etc.)Oid *argtypespointer to an array containing the OIDs of the data types of the parameters
intcursorOptionsinteger 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, CURSOR_OPT_FAST_PLAN, CURSOR_OPT_GENERIC_PLAN, and CURSOR_OPT_CUSTOM_PLAN. Note in particular that CURSOR_OPT_HOLD is ignored.