Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/152.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql C++;驱动程序-创建后获取准备语句查询 我在C++应用程序中大量使用准备好的语句。我遇到的问题是,当mysql查询抛出错误(即外键约束)时_C++_Mysql_Exception_Exception Handling_Driver - Fatal编程技术网

Mysql C++;驱动程序-创建后获取准备语句查询 我在C++应用程序中大量使用准备好的语句。我遇到的问题是,当mysql查询抛出错误(即外键约束)时

Mysql C++;驱动程序-创建后获取准备语句查询 我在C++应用程序中大量使用准备好的语句。我遇到的问题是,当mysql查询抛出错误(即外键约束)时,c++,mysql,exception,exception-handling,driver,C++,Mysql,Exception,Exception Handling,Driver,我希望能够以某种方式获得该查询,以便进行调试。 下面是MysqlWrapper.cpp中的一个小代码示例 (我写的一个类,包了C++驱动程序) 准备好的语句不值得在MySQL上遇到这些问题,它们比经典的SQL语句快不了多少。它们不像在其他RDBMS中那样编译。 我认为在这种情况下,最好使用批插入而不是准备好的语句 long MysqlWrapper::Insert(sql::PreparedStatement *stmt) { try {

我希望能够以某种方式获得该查询,以便进行调试。 下面是MysqlWrapper.cpp中的一个小代码示例 (我写的一个类,包了C++驱动程序)


准备好的语句不值得在MySQL上遇到这些问题,它们比经典的SQL语句快不了多少。它们不像在其他RDBMS中那样编译。 我认为在这种情况下,最好使用批插入而不是准备好的语句

    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?
        }
    }