Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

spi_execute_with_args(3) [centos man page]

SPI_EXECUTE_WITH_ARGS(3)				  PostgreSQL 9.2.7 Documentation				  SPI_EXECUTE_WITH_ARGS(3)

NAME
SPI_execute_with_args - execute a command with out-of-line parameters SYNOPSIS
int SPI_execute_with_args(const char *command, int nargs, Oid *argtypes, Datum *values, const char *nulls, bool read_only, long count) DESCRIPTION
SPI_execute_with_args executes a command that might include references to externally supplied parameters. The command text refers to a parameter as $n, and the call specifies data types and values for each such symbol. read_only and count have the same interpretation as in SPI_execute. The main advantage of this routine compared to SPI_execute is that data values can be inserted into the command without tedious quoting/escaping, and thus with much less risk of SQL-injection attacks. Similar results can be achieved with SPI_prepare followed by SPI_execute_plan; however, when using this function the query plan is always customized to the specific parameter values provided. For one-time query execution, this function should be preferred. If the same command is to be executed with many different parameters, either method might be faster, depending on the cost of re-planning versus the benefit of custom plans. ARGUMENTS
const char * command command string int nargs number of input parameters ($1, $2, etc.) Oid * argtypes an array containing the OIDs of the data types of the parameters Datum * values an array of actual parameter values const char * nulls an array describing which parameters are null If nulls is NULL then SPI_execute_with_args assumes that no parameters are null. bool read_only true for read-only execution long count maximum number of rows to return, or 0 for no limit RETURN VALUE
The return value is the same as for SPI_execute. SPI_processed and SPI_tuptable are set as in SPI_execute if successful. PostgreSQL 9.2.7 2014-02-17 SPI_EXECUTE_WITH_ARGS(3)

Check Out this Related Man Page

SPI_EXECUTE_PLAN(3)					  PostgreSQL 9.2.7 Documentation				       SPI_EXECUTE_PLAN(3)

NAME
SPI_execute_plan - execute a statement prepared by SPI_prepare SYNOPSIS
int SPI_execute_plan(SPIPlanPtr plan, Datum * values, const char * nulls, bool read_only, long count) DESCRIPTION
SPI_execute_plan executes a statement prepared by SPI_prepare or one of its siblings. read_only and count have the same interpretation as in SPI_execute. ARGUMENTS
SPIPlanPtr plan prepared statement (returned by SPI_prepare) Datum * values An array of actual parameter values. Must have same length as the statement's number of arguments. const char * nulls An array describing which parameters are null. Must have same length as the statement's number of arguments. n indicates a null value (entry in values will be ignored); a space indicates a nonnull value (entry in values is valid). If nulls is NULL then SPI_execute_plan assumes that no parameters are null. bool read_only true for read-only execution long count maximum number of rows to return, or 0 for no limit RETURN VALUE
The return value is the same as for SPI_execute, with the following additional possible error (negative) results: SPI_ERROR_ARGUMENT if plan is NULL or invalid, or count is less than 0 SPI_ERROR_PARAM if values is NULL and plan was prepared with some parameters SPI_processed and SPI_tuptable are set as in SPI_execute if successful. PostgreSQL 9.2.7 2014-02-17 SPI_EXECUTE_PLAN(3)
Man Page

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Results of command execution into array

Hi Can anybody tell me how can I dump the results of execution of a command into array form? For example, I want to execute: and put each part of the result in an array element: Thanks (2 Replies)
Discussion started by: alirezan
2 Replies

2. UNIX for Dummies Questions & Answers

check parameters

Hi, I have a script that takes two parameters. I would check the script to run if these parameters are to null or come with the correct data. If those parameters are to null, display a message, so if they come with two facts that are incorrect. As you might see that? Thx (1 Reply)
Discussion started by: pepeli30
1 Replies

3. Shell Programming and Scripting

Array from cli input

I need to create a bash array from the command line parameters. I only know how to do it when I know the number of parameters. But what do I do when I dont know the number of parameters? (1 Reply)
Discussion started by: locoroco
1 Replies

4. UNIX for Dummies Questions & Answers

Remove or truncate trailing nulls from file

(9 Replies)
Discussion started by: Tribe
9 Replies

5. UNIX for Beginners Questions & Answers

Passing parameters and accepting in Array

I am trying to pass parameters to a script which will accept them in array. First parameter is where_clause second parameter is "SRC_TYPE='SYBASE' and PROCESS_CD='BRK'" } echo $2 $ ./abcd.ksh where_clause "SRC_TYPE='SYBASE' and PROCESS_CD='BRK'" + set -A arg_list -- where_clause... (3 Replies)
Discussion started by: ratheeshjulk
3 Replies