PQsendQueryPrepared
Description
Sends a request to execute a prepared statement with given parameters, without waiting for the result.
Prototype
int PQsendQueryPrepared(PGconn* conn, const char* stmtName, int nParams, const char* const* paramValues,
const int* paramLengths, const int* paramFormats, int resultFormat); Parameters
| Keyword | Description |
|---|---|
| conn | Object pointer that contains the connection information. |
| stmtName | Name of a prepared statement to be executed. |
| nParams | Parameter quantity. |
| paramValues | Parameter value. |
| paramLengths | Parameter length. NOTICE: In the following cases, the parameter length is forcibly set to the corresponding value of paramLengths:
In these cases, paramLengths cannot be empty, and the caller must ensure the correctness of the parameter length. |
| paramFormats | Parameter format. |
| resultFormat | Result format. |
Return Values
int indicates the execution result. 1 indicates successful execution and 0 indicates an execution failure. The failure cause is stored in conn->errorMessage.
Precautions
This function is similar to PQsendQueryParams, but the command to be executed is specified by naming a previously-prepared statement, instead of providing a query string. The parameters of this function are processed in the same way as PQexecPrepared. Like PQexecPrepared, it cannot work on connections using protocol v2.0.