1SPI_EXECUTE_WITH_ARGS(3)PostgreSQL 9.2.24 DocumentationSPI_EXECUTE_WITH_ARGS(3)
2
3
4

NAME

6       SPI_execute_with_args - execute a command with out-of-line parameters
7

SYNOPSIS

9       int SPI_execute_with_args(const char *command,
10                                 int nargs, Oid *argtypes,
11                                 Datum *values, const char *nulls,
12                                 bool read_only, long count)
13

DESCRIPTION

15       SPI_execute_with_args executes a command that might include references
16       to externally supplied parameters. The command text refers to a
17       parameter as $n, and the call specifies data types and values for each
18       such symbol.  read_only and count have the same interpretation as in
19       SPI_execute.
20
21       The main advantage of this routine compared to SPI_execute is that data
22       values can be inserted into the command without tedious
23       quoting/escaping, and thus with much less risk of SQL-injection
24       attacks.
25
26       Similar results can be achieved with SPI_prepare followed by
27       SPI_execute_plan; however, when using this function the query plan is
28       always customized to the specific parameter values provided. For
29       one-time query execution, this function should be preferred. If the
30       same command is to be executed with many different parameters, either
31       method might be faster, depending on the cost of re-planning versus the
32       benefit of custom plans.
33

ARGUMENTS

35       const char * command
36           command string
37
38       int nargs
39           number of input parameters ($1, $2, etc.)
40
41       Oid * argtypes
42           an array containing the OIDs of the data types of the parameters
43
44       Datum * values
45           an array of actual parameter values
46
47       const char * nulls
48           an array describing which parameters are null
49
50           If nulls is NULL then SPI_execute_with_args assumes that no
51           parameters are null.
52
53       bool read_only
54           true for read-only execution
55
56       long count
57           maximum number of rows to return, or 0 for no limit
58

RETURN VALUE

60       The return value is the same as for SPI_execute.
61
62       SPI_processed and SPI_tuptable are set as in SPI_execute if successful.
63
64
65
66PostgreSQL 9.2.24                 2017-11-06          SPI_EXECUTE_WITH_ARGS(3)
Impressum