SPI_execp

Name

SPI_execp --  Executes a plan from SPI_saveplan SPI_saveplan によって得られる計画を実行します。

Synopsis

SPI_execp(plan,
values,
nulls,
tcount)

入力

void *plan

Execution plan

実行計画。

Datum *values

Actual parameter values

実パラメータの値。

char *nulls

Array describing what parameters get NULLs

'n' indicates NULL allowed
' ' indicates NULL not allowed

どのパラメータが NULL を許すかを記述した配列。

'n' は NULL を許すことを示します。
' ' は NULL を許さないことを示します。

int tcount

Number of tuples for which plan is to be executed

計画が実行対象とするタプルの数。

出力

int

Returns the same value as SPI_exec as well as

SPI_exec 同様、次のものを返します。

SPI_ERROR_ARGUMENT if plan is NULL or tcount < 0 引数 plan が NULL または 引数 tcount < 0の場合。
SPI_ERROR_PARAM if values is NULL and plan was prepared with some parameters. 引数 values が NULL かつ、 引数 plan が何かしらの引 数を必要とする場合。

SPI_tuptable

initialized as in SPI_exec if successful

成功すると、SPI_exec と同じように初期化されます。

SPI_processed

initialized as in SPI_exec if successful

成功すると、SPI_exec と同じように初期化されます。

説明

SPI_execp stores a plan prepared by SPI_prepare in safe memory protected from freeing by SPI_finish or the transaction manager.

SPI_execp は、SPI_prepare に よって作成された計画を SPI_finish やトランザクショ ンマネージャによって行なわれるメモリの開放の影響を受けない安全なメモリ領 域に保存します。

In the current version of Postgres there is no ability to store prepared plans in the system catalog and fetch them from there for execution. This will be implemented in future versions. As a work arround, there is the ability to reuse prepared plans in the consequent invocations of your procedure in the current session. Use SPI_execp to execute this saved plan.

現状の Postgres では、準備済み計画をシ ステムカタログに保存しておき、実行時にそれを取り出すといった機能は ありません。この機能は将来実装されるでしょう。 代わりに、同じセッションの中で、後から起動されるプロシージャが準備 済み計画を再利用する機能はあります。この保存された計画を実行するに は、SPI_execp を使用して下さい。 spi_saveplanとほぼ同じものになっています。

使い方

If nulls is NULL then SPI_execp assumes that all values (if any) are NOT NULL.

引数 nulls がNULLの場 合、SPI_execpは、(取り得る)全ての値は非 NULL であるものとします。

Note: If one of the objects (a relation, function, etc.) referenced by the prepared plan is dropped during your session (by your backend or another process) then the results of SPI_execp for this plan will be unpredictable.

セッション中に準備済み計画が参照する(リレーション、関数などの)オ ブジェクトが 1 つでも(バックエンドや他のプロセスによって)削除され ると、この計画を使った SPI_execp の結果は予測 できないものになります。