更新时间:2025-05-29 GMT+08:00

PQexecPreparedBatchEx

功能描述

BatchErrorMode批量请求接口。

原型

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);

参数

表1 PQexecPreparedBatchEx参数

关键字

参数说明

conn

连接句柄。

stmtName

prepared 语句名字。

nParams

动态绑定参数的字段数。

nBatchCount

批量绑定的行数。

paramValues

绑定参数值。

paramLengths

参数值的数据长度。

须知:

下列情况中,参数长度强制使用paramLengths中对应的值:

  • 参数格式为二进制。
  • 参数格式为文本且连接参数force_no_truncation的值为1。

此时paramLengths不允许为空,并且参数长度的正确性须由调用者自行保证。

paramFormats

参数的格式(文本或二进制)。

resultFormat

结果的格式(文本或二进制)。

attr

此次批量执行属性,是否使用批量错误跳过模式。取值范围:STMT_DEFAULT , STMT_BATCH_ERRORS。

allowedErrorsCount

使用批量错误跳过模式时,允许的最大错误数。

返回值

PGresult类型指针。