Postgresql 中文操作指南

SPI_is_cursor_plan

SPI_is_cursor_plan — 如果使用 SPI_cursor_open 可使用 SPI_prepare 准备的语句,则返回 true

SPI_is_cursor_plan — return true if a statement prepared by SPI_prepare can be used with SPI_cursor_open

Synopsis

bool SPI_is_cursor_plan(SPIPlanPtr plan)

Description

如果使用 SPI_cursor_open 可将 SPI_prepare 准备的语句作为参数传递,则 SPI_is_cursor_plan 返回 true ;否则返回 false 。标准是 plan 表示一个单一命令,并且此命令向调用者返回元组;例如, SELECT 允许,除非它包含 INTO 子句,而且 UPDATE 仅当它包含 RETURNING 子句时才允许。

SPI_is_cursor_plan returns true if a statement prepared by SPI_prepare can be passed as an argument to SPI_cursor_open, or false if that is not the case. The criteria are that the plan represents one single command and that this command returns tuples to the caller; for example, SELECT is allowed unless it contains an INTO clause, and UPDATE is allowed only if it contains a RETURNING clause.

Arguments

  • SPIPlanPtr _plan_

    • prepared statement (returned by SPI_prepare)

Return Value

truefalse 指示 plan 是否可以生成游标,而将 SPI_result 设置为零。如果无法确定答案(例如,如果 planNULL 或无效,或者在未连接到 SPI 时调用),则将 SPI_result 设置为合适的错误代码,并返回 false

true or false to indicate if the plan can produce a cursor or not, with SPI_result set to zero. If it is not possible to determine the answer (for example, if the plan is NULL or invalid, or if called when not connected to SPI), then SPI_result is set to a suitable error code and false is returned.