Skip to content

SPI_prepare_cursor ​

SPI_prepare_cursor — 准备一条语句,但不立即执行

概要 ​

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

描述 ​

SPI_prepare_cursor与SPI_prepare相同,但它还允许指定计划器的“游标选项”参数。这是一个位掩码,其值在nodes/parsenodes.h中显示为DeclareCursorStmt的options字段。SPI_prepare始终将游标选项作为零。

此函数现已弃用,建议使用SPI_prepare_extended。

参数 ​

const char * command

命令字符串

int nargs

输入参数数量($1、$2 等)

Oid * argtypes

指向包含参数数据类型的 的数组的指针

int cursorOptions

游标选项的整数位掩码;零会产生默认行为

返回值 ​

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会被忽略。