SPI_execute_with_receiver — execute a command with out-of-line parameters
int SPI_execute_with_receiver(const char *command
, ParamListInfoparams
, boolread_only
, longcount
, DestReceiver *dest
)
SPI_execute_with_receiver
executes a command that might
include references to externally supplied parameters. The command text
refers to a parameter as $
,
and the n
params
object provides values and type
information for each such symbol.
read_only
and count
have
the same interpretation as in SPI_execute
.
If dest
is not NULL, then result tuples are passed
to that object as they are generated by the executor, instead of being
accumulated in SPI_tuptable
. Using a
caller-supplied DestReceiver
object 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.
The params
object should normally mark each
parameter with the PARAM_FLAG_CONST
flag, since
a one-shot plan is always used for the query.
const char * command
command string
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, tuples are returned
in SPI_tuptable
The return value is the same as for SPI_execute
.
When dest
is NULL,
SPI_processed
and
SPI_tuptable
are set as in
SPI_execute
.
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.