- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用模板查询来构建我的 SQL 查询。这是示例代码:
unsigned int version = 2;
try {
// key_version is INT UNSIGNED
mysqlpp::Query query = conn->query("SELECT * FROM agentlist WHERE key_version != %0q");
mysqlpp::StoreQueryResult res = query.store(version);
// string type param also caused the same problem
// mysqlpp::StoreQueryResult res = query.store(std::to_string(version));
} catch (const exception &ex) {
// deal with exceptions
}
代码将转到catch
部分。 ex.what()
:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'2\' at line 1
我认为这是由 SQLQueryParms
类型引起的,但教程和文档都没有显示任何解决此问题的方法。
顺便说一句,如何获取解析的查询字符串(替换模板参数)?我尝试了 query.str(version)
但它与 query.str()
相同。
最佳答案
我的错。忘记了一个重要的函数调用 query.parse()
。
现在一切正常了。
关于mysqlpp : SQL syntax error when using template queries,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46767045/
和其他许多人一样,我在编译包含 mysqlpp 的程序时遇到了问题。 mysqlpp 似乎安装正确,库路径也在/etc/ld.so.conf 中正确设置并且已知(所以我认为): $ sudo ldco
我试图控制连接方法超时,但我没有找到合适的方法。 需要说明的是,我不是在谈论空闲连接超时 (ConnectTimeoutOption)。 我需要处理的场景是数据库消失了,我的服务器必须处理这个问题。我
我是C++的新手,刚用C++用mysql ++。h查询sql数据库 SQL查询本身有效,我可以打印出结果。 char *token; Query query = conn.query(); query
这是我在运行这段代码时遇到的错误: if(mysqlpp::UseQueryResult res = conn.query(sql).use()) 比较有意思的是下一行没有任何问题 while(my
我需要从数据库 (MariaDB) 中检索一个 INT 并将其放入使用 GTK3 制作的列表中。 当我尝试将变量从 MariaDB 传递到 GTK3 时,编译器抛出以下错误: 无法通过“...”传递不
我想知道是否有更快的方法将我的数据从 mysqlpp::storequeryresult 复制到 std::vector。 我的例子如下:我用 query.store() 将我的查询结果存储在 Sto
我尝试使用模板查询来构建我的 SQL 查询。这是示例代码: unsigned int version = 2; try { // key_version is INT UNSIGNED
好的,我对使用 Visual Studio 中使用的 mysqlpp 库连接到 MySQL 数据库还比较陌生,并且在尝试将 mysqlpp::String 类型的 vector 转换为 int 类型的
为这个系上安全带。 很奇怪,我在网上找不到任何关于此类错误的信息,但这让我抓狂。希望你们能对这个问题有所了解。 我正在使用 MySQL++ 从表中获取一些基本数据。它可以很好地连接到数据库并且查询似乎
我在尝试构建将 mysqlpp::Connection 对象作为我的 wxFrame 对象的私有(private)成员的代码时遇到错误。 class MyFrame: public wxFrame {
我是一名优秀的程序员,十分优秀!