Postgresql 中文操作指南

SPI_cursor_open_with_paramlist

SPI_cursor_open_with_paramlist——使用参数设定一个光标

SPI_cursor_open_with_paramlist — set up a cursor using parameters

Synopsis

Portal SPI_cursor_open_with_paramlist(const char *name,
                                      SPIPlanPtr plan,
                                      ParamListInfo params,
                                      bool read_only)

Description

SPI_cursor_open_with_paramlist 设置一个光标(内部门户)以执行 SPI_prepare 准备好的语句。 此函数等同于 SPI_cursor_open ,但传入查询的参数值的的信息呈现不同。 ParamListInfo 表示对于传入该格式的值非常方便。 它也支持通过 ParamListInfo 中指定挂接函数使用动态参数集。

SPI_cursor_open_with_paramlist sets up a cursor (internally, a portal) that will execute a statement prepared by SPI_prepare. This function is equivalent to SPI_cursor_open except that information about the parameter values to be passed to the query is presented differently. The ParamListInfo representation can be convenient for passing down values that are already available in that format. It also supports use of dynamic parameter sets via hook functions specified in ParamListInfo.

传入的参数数据将被复制到光标的门户中,因此可在光标仍然存在时释放它。

The passed-in parameter data will be copied into the cursor’s portal, so it can be freed while the cursor still exists.

Arguments

  • const char * _name_

    • name for portal, or NULL to let the system select a name

  • SPIPlanPtr _plan_

    • prepared statement (returned by SPI_prepare)

  • ParamListInfo _params_

    • data structure containing parameter types and values; NULL if none

  • bool _read_only_

    • true for read-only execution

Return Value

  • 指向包含光标的门户。请注意,没有错误返回约定;任何错误将通过 elog 报告。

Pointer to portal containing the cursor. Note there is no error return convention; any error will be reported via elog.