SPI_execute_plan_with_receiver — execute a statement prepared by SPI_prepare
int SPI_execute_plan_with_receiver(SPIPlanPtrplan
, ParamListInfoparams
, boolread_only
, longcount
, DestReceiver *dest
)
SPI_execute_plan_with_receiver
executes a statement
prepared by SPI_prepare
. This function is
equivalent to SPI_execute_plan_with_paramlist
except that, instead of always accumulating the result tuples into a
SPI_tuptable
structure, tuples can be passed to a
caller-supplied DestReceiver
object as they are
generated by the executor. This is particularly helpful for queries
that might generate many tuples, since the data can be processed
on-the-fly instead of being accumulated in memory.
SPIPlanPtr plan
prepared statement (returned by SPI_prepare
)
ParamListInfo params
data structure containing parameter types and values; NULL if none
bool read_only
true
for read-only execution
long count
maximum number of rows to return,
or 0
for no limit
DestReceiver * dest
DestReceiver
object that will receive any tuples
emitted by the query; if NULL, this function is exactly equivalent to
SPI_execute_plan_with_paramlist
The return value is the same as for SPI_execute_plan
.
When dest
is NULL,
SPI_processed
and
SPI_tuptable
are set as in
SPI_execute_plan
.
When dest
is not NULL,
SPI_processed
is set to zero and
SPI_tuptable
is set to NULL. If a tuple count
is required, the caller's DestReceiver
object must
calculate it.