Postgresql 中文操作指南

SPI_keepplan

SPI_keepplan — 保存已准备好的语句

SPI_keepplan — save a prepared statement

Synopsis

int SPI_keepplan(SPIPlanPtr plan)

Description

SPI_keepplan 保存传递的语句(由 SPI_prepare 准备),使其不会被 SPI_finish 或事务管理器释放。这使你可以重用当前会话中 C 函数的后续调用中的准备好的语句。

SPI_keepplan saves a passed statement (prepared by SPI_prepare) so that it will not be freed by SPI_finish nor by the transaction manager. This gives you the ability to reuse prepared statements in the subsequent invocations of your C function in the current session.

Arguments

  • SPIPlanPtr _plan_

    • the prepared statement to be saved

Return Value

成功时为 0;如果 planNULL 或无效,则为 SPI_ERROR_ARGUMENT

0 on success; SPI_ERROR_ARGUMENT if plan is NULL or invalid

Notes

通过指针调整,将传入语句移至永久存储(不需要数据复制)。如果你以后希望删除它,请使用 SPI_freeplan

The passed-in statement is relocated to permanent storage by means of pointer adjustment (no data copying is required). If you later wish to delete it, use SPI_freeplan on it.