postgres-cn / pgdoc-cn

PostgreSQL manual Chinese translation by China PostgreSQL Users Group
http://www.postgres.cn/docs
Other
1.79k stars 399 forks source link

翻译有误, PQsetSingleRowMode 应该在 PQsendQuery 之后调用 #422

Closed gamefunc closed 1 year ago

gamefunc commented 1 year ago

英文原文是: call PQsetSingleRowMode immediately after a successful call of PQsendQuery (or a sibling function); 代码测试下也是 PQsetSingleRowMode(conn) 应该在 PQsendQuery(conn, cmd) 后调用;

PQsetSingleRowMode(conn) 设置成功返回1, 失败返回0, 测试代码如下:

// 成功: ok 得 1; int ok = PQsendQuery(conn, cmd.data()); ok = PQsetSingleRowMode(conn); std::cout << std::format("设单行结果: {}\n", ok);

// 反过来后再运行: 失败: ok 得 0: int ok = PQsetSingleRowMode(conn); std::cout << std::format("设单行结果: {}\n", ok); ok = PQsendQuery(conn, cmd.data());

ChenHuajun commented 1 year ago

你是对的,感谢fix