Redrock Postgres 搜索 英文
版本: 9.3 / 9.4 / 9.5 / 9.6 / 10 / 11 / 12 / 13 / 14 / 15 / 16 / 17

SPI_execute_plan

SPI_execute_plan — 执行由 SPI_prepare 准备的语句

概要

int SPI_execute_plan(SPIPlanPtr plan, Datum * values, const char * nulls,
                     bool read_only, long count)

描述

SPI_execute_plan 执行由 SPI_prepare 或其相邻函数准备的语句。read_onlycount 具有与 SPI_execute 相同的解释。

参数

SPIPlanPtr plan

准备好的语句(由 SPI_prepare 返回)

Datum * values

实际参数值的数组。必须与语句参数数量相同。

const char * nulls

描述哪个参数为 null 的数组。必须与语句参数数量相同。

如果 nullsNULL,则 SPI_execute_plan 假设没有 null 参数。否则,nulls 数组的各个条目应为 ' '(如果相应的参数值非 null)或 'n'(如果相应的参数值 null)。(在后一种情况下,values 条目中实际的值无关紧要。)请注意,nulls 不是文本字符串,而仅仅是一个数组:它不需要 '\0' 结束符。

bool read_only

true 适用于只读执行

long count

要返回的最大行数,或 0 表示无限制

返回值

返回值与 SPI_execute 相同,有以下可能的错误(负值)结果

SPI_ERROR_ARGUMENT

如果 planNULL 或无效,或 count 小于 0

SPI_ERROR_PARAM

如果 valuesNULLplan 是用某些参数准备的

如果成功,SPI_processed 和 SPI_tuptable 会像在 SPI_execute 中一样设置。