我有一个用 C++ 编写的 MySQL 客户端。我想按照此处所述启用 MultipleStatement 选项,但当然对于 C++:

http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html

在谷歌上找不到这个是不可能的。也无法找到 C++/Connector 的任何文档。这很令人沮丧。

如果有人知道我的问题的任何解决方案或任何非常有帮助的文档页面。

谢谢

最佳答案

这对我有用:

sql::ConnectOptionsMap connection_properties;

connection_properties["hostName"]=sql::SQLString("localhost");
connection_properties["userName"]=sql::SQLString("username");
connection_properties["password"]=sql::SQLString("password");
connection_properties["CLIENT_MULTI_STATEMENTS"]=(true);

sql::Driver * driver = get_driver_instance();
std::unique_ptr<sql::Connection> con(driver->connect(connection_properties));

问候,

关于c++ - MySQL C++/Connector setClientOption 支持多语句,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20420116/

10-12 04:54