【发布时间】:2013-07-19 02:18:32
【问题描述】:
我在我的 c++ 应用程序中大量使用准备好的语句。我遇到的问题是,当 mysql 查询抛出错误(即外键约束)时,
我希望能够以某种方式获取该查询,以便进行调试。 这是来自 MysqlWrapper.cpp 的一个小代码示例 (我写的一个封装了 C++ 驱动的类)
long MysqlWrapper::Insert(sql::PreparedStatement *stmt)
{
try
{
stmt->execute();
...
//return inserted id
}
catch(sql::SQLException &ex)
{
// How can I get the query being executed by stmt?
}
}
【问题讨论】:
标签: c++ mysql exception exception-handling driver