SPI_is_cursor_plan
<refpurpose>return <symbol>true</symbol> if a statement
prepared by <function>SPI_prepare</function> can be used with
<function>SPI_cursor_open</function></refpurpose>
—
SPI_prepareで準備された文がSPI_cursor_openで使用できる場合にtrueを返す
bool SPI_is_cursor_plan(SPIPlanPtr plan)
<function>SPI_is_cursor_plan</function> returns <symbol>true</symbol>
if a statement prepared by <function>SPI_prepare</function> can be passed
as an argument to <function>SPI_cursor_open</function>, or
<symbol>false</symbol> if that is not the case. The criteria are that the
<parameter>plan</parameter> represents one single command and that this
command returns tuples to the caller; for example, <command>SELECT</command>
is allowed unless it contains an <literal>INTO</literal> clause, and
<command>UPDATE</command> is allowed only if it contains a <literal>RETURNING</literal>
clause.
SPI_prepareで準備済み文がSPI_cursor_openへの引数として渡すことができる場合、SPI_is_cursor_planはtrueを返します。
渡すことができない場合はfalseを返します。
この基準は、planが単一のコマンドであり、かつ、そのコマンドが呼び出し元にタプルを返すことです。
例えば、INTO句を含んでいないSELECTは可能です。
そして、RETURNING句を含む場合のみUPDATEも可能です。
SPIPlanPtr plan
prepared statement (returned by <function>SPI_prepare</function>)
(SPI_prepareで返される)準備済み文
<symbol>true</symbol> or <symbol>false</symbol> to indicate if the
<parameter>plan</parameter> can produce a cursor or not, with
<varname>SPI_result</varname> set to zero.
If it is not possible to determine the answer (for example,
if the <parameter>plan</parameter> is <symbol>NULL</symbol> or invalid,
or if called when not connected to SPI), then
<varname>SPI_result</varname> is set to a suitable error code
and <symbol>false</symbol> is returned.
planがカーソルを生成することができるかどうかを示すtrueもしくはfalseです。
そしてSPI_resultをゼロに設定します。
解答を決定することができない場合(例えばplanがNULL、または無効な場合、もしくはSPI未接続時に呼び出された場合)はSPI_resultに適切なエラーコードが設定され、falseが返されます。