gpt4 book ai didi

c++ - Mysql 连接器 C++ 无缓冲结果集 C++

转载 作者:行者123 更新时间:2023-11-28 05:18:25 24 4
gpt4 key购买 nike

我有一个包含大量数据的表。我想获取所有数据并一一处理。

根据这里的文档: https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-examples-results.html

The API for fetching result sets is identical for (simple) statements and prepared statements. If your query returns one result set, use sql::Statement::executeQuery() or sql::PreparedStatement::executeQuery() to run your query. Both methods return sql::ResultSet objects. By default, Connector/C++ buffers all result sets on the client to support cursors.

它说默认情况下它会缓冲客户端上的所有结果集。我怎样才能禁用它?

最佳答案

在语句中,您可以定义结果集的类型。使用 TYPE_FORWARD_ONLY 会导致未缓冲的结果集,如 mysql release notes 中定义的那样:

... Implemented getResultSetType() and setResultSetType() for Statement. Uses TYPE_FORWARD_ONLY, which means unbuffered result set and TYPE_SCROLL_INSENSITIVE, which means buffered result set.

希望对您有所帮助。

关于c++ - Mysql 连接器 C++ 无缓冲结果集 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42097354/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com