SPI_execute_plan
<refpurpose>execute a statement prepared by <function>SPI_prepare</function></refpurpose>
— SPI_prepareで準備された文を実行する
int SPI_execute_plan(SPIPlanPtrplan, Datum *values, const char *nulls, boolread_only, longcount)
<function>SPI_execute_plan</function> executes a statement prepared by
<function>SPI_prepare</function> or one of its siblings.
<parameter>read_only</parameter> and
<parameter>count</parameter> have the same interpretation as in
<function>SPI_execute</function>.
SPI_execute_planは、SPI_prepareもしくは類似の関数で準備された文を実行します。
read_onlyとcountはSPI_executeと同様の解釈がなされます。
SPIPlanPtr plan
prepared statement (returned by <function>SPI_prepare</function>)
(SPI_prepareで返される)準備済み文
Datum * valuesAn array of actual parameter values. Must have same length as the statement's number of arguments. 実パラメータ値の配列。 文の引数の数と同じ長さでなければなりません。
const char * nullsAn array describing which parameters are null. Must have same length as the statement's number of arguments. どのパラメータがNULLであるかを示す配列。 文の引数の数と同じ長さでなければなりません。
If <parameter>nulls</parameter> is <symbol>NULL</symbol> then
<function>SPI_execute_plan</function> assumes that no parameters
are null. Otherwise, each entry of the <parameter>nulls</parameter>
array should be <literal>' '</literal> if the corresponding parameter
value is non-null, or <literal>'n'</literal> if the corresponding parameter
value is null. (In the latter case, the actual value in the
corresponding <parameter>values</parameter> entry doesn't matter.) Note
that <parameter>nulls</parameter> is not a text string, just an array:
it does not need a <literal>'\0'</literal> terminator.
nullsがNULLの場合、SPI_execute_planはすべてのパラメータがNULLではないとみなします。
さもなければ、nulls配列の各項目は、対応するパラメータが非NULLならば' '、対応するパラメータがNULLならば'n'です。
(後者の場合、values内の対応する値は注意されません。)
nullsはテキスト文字列ではなく単なる配列であることに注意してください。
'\0'終端は必要ありません。
bool read_only
読み取りのみの実行の場合true
long count
maximum number of rows to return,
or <literal>0</literal> for no limit
返される行の最大数。無制限なら0。
The return value is the same as for <function>SPI_execute</function>,
with the following additional possible error (negative) results:
戻り値は、SPI_execute同様のものに加え、以下のエラー(負)の結果を取ることがあります。
SPI_ERROR_ARGUMENT
if <parameter>plan</parameter> is <symbol>NULL</symbol> or invalid,
or <parameter>count</parameter> is less than 0
planがNULLまたは無効、あるいは、countが0未満の場合
SPI_ERROR_PARAM
if <parameter>values</parameter> is <symbol>NULL</symbol> and
<parameter>plan</parameter> was prepared with some parameters
valuesがNULL、かつ、planがパラメータ付きで準備された場合
<varname>SPI_processed</varname> and
<varname>SPI_tuptable</varname> are set as in
<function>SPI_execute</function> if successful.
成功時、SPI_processedとSPI_tuptableがSPI_execute同様に設定されます。