Postgresql 中文操作指南
SPI_prepare_cursor
SPI_prepare_cursor — 准备一个语句,但不执行它
SPI_prepare_cursor — prepare a statement, without executing it yet
Synopsis
SPIPlanPtr SPI_prepare_cursor(const char * command, int nargs,
Oid * argtypes, int cursorOptions)
Description
SPI_prepare_cursor 与 SPI_prepare 相同,区别在于它还允许指定计划程序的“游标选项”参数。这是一种位掩码,它具有 nodes/parsenodes.h 中所示的值,用于 DeclareCursorStmt 的 options 字段。 SPI_prepare 始终将游标选项视为零。
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.
此函数现已弃用,建议使用 SPI_prepare_extended 。
This function is now deprecated in favor of SPI_prepare_extended.
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 具有与 SPI_prepare 相同的返回约定。
SPI_prepare_cursor has the same return conventions as SPI_prepare.
Notes
方便设置在 cursorOptions 中的位包括 CURSOR_OPT_SCROLL 、 CURSOR_OPT_NO_SCROLL 、 CURSOR_OPT_FAST_PLAN 、 CURSOR_OPT_GENERIC_PLAN 和 CURSOR_OPT_CUSTOM_PLAN 。特别是,请注意 CURSOR_OPT_HOLD 已被忽略。
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.