Updated on 2025-05-29 GMT+08:00

PQexecPreparedBatchEx

Description

A batch request API for BatchErrorMode.

Prototype

PGresult* PQexecPreparedBatchEx(PGconn* conn, 
                                const char* stmtName, 
                                int nParams, 
                                int nBatchCount,
                                const char* const* paramValues, 
                                const int* paramLengths, 
                                const int* paramFormats, 
                                int resultFormat, 
                                PQStmtAttr attr,
                                int allowedErrorsCount);

Parameters

Table 1 PQexecPreparedBatchEx parameters

Keyword

Description

conn

Connection handle.

stmtName

Name of the prepared statement.

nParams

Number of fields of a dynamically bound parameter.

nBatchCount

Number of lines to be bound in batches.

paramValues

Bound parameter value.

paramLengths

Data length of a parameter value.

NOTICE:

In the following cases, the parameter length is forcibly set to the corresponding value of paramLengths:

  • The parameter is in binary format.
  • The parameter is in text format and the value of force_no_truncation is 1.

In these cases, paramLengths cannot be empty, and the caller must ensure the correctness of the parameter length.

paramFormats

Parameter formats (text or binary).

resultFormat

Return result format (text or binary).

attr

Specifies whether to skip errors in batches. Value range: STMT_DEFAULT and STMT_BATCH_ERRORS.

allowedErrorsCount

Maximum number of errors that can be skipped in batches.

Return Values

PGresult pointers.