Postgresql 中文操作指南

SPI_connect

SPI_connect、SPI_connect_ext — 将 C 函数连接到 SPI 管理器

SPI_connect, SPI_connect_ext — connect a C function to the SPI manager

Synopsis

int SPI_connect(void)
int SPI_connect_ext(int options)

Description

SPI_connect 从 C 函数调用打开与 SPI 管理器的连接。如果要通过 SPI 执行命令,必须调用此函数。可以从未连接的 C 函数调用一些实用 SPI 函数。

SPI_connect opens a connection from a C function invocation to the SPI manager. You must call this function if you want to execute commands through SPI. Some utility SPI functions can be called from unconnected C functions.

SPI_connect_ext 执行相同操作,但有一个参数允许传递选项标志。当前,提供以下选项值:

SPI_connect_ext does the same but has an argument that allows passing option flags. Currently, the following option values are available:

  • SPI_OPT_NONATOMIC

    • Sets the SPI connection to be nonatomic, which means that transaction control calls (SPI_commit, SPI_rollback) are allowed. Otherwise, calling those functions will result in an immediate error.

SPI_connect() 等同于 SPI_connect_ext(0)

SPI_connect() is equivalent to SPI_connect_ext(0).

Return Value

  • SPI_OK_CONNECT

    • on success

  • SPI_ERROR_CONNECT

    • on error