如何修复IBPP :: LogicException:未知或不受支持的语句类型?

问题描述

我正在使用C++ API for firebird数据库

我可以连接数据库,但是当我尝试执行一条语句时,出现此错误

*** IBPP::LogicException ***
Context: Statement::Prepare
Message: UnkNown or unsupported statement type

我班上遇到此错误代码段是这样的(遵循reference documentation samples上的执行语句部分):

try
{
    this->database = IBPP::DatabaseFactory(
        ServerName,DatabaseName,UserName,UserPassword);
    this->database->Connect();
}
catch(IBPP::Exception& e)
{
    cout << e.ErrorMessage() << endl;
}

IBPP::Transaction tr = IBPP::TransactionFactory(this->database);
IBPP::Statement st = IBPP::StatementFactory(this->database,tr);

if (this->database->Connected() == false) {
    throw "No database!!!";
}

try
{
    tr->Start();

    st->Prepare("SELECT a.ID from test a");

    st->Execute();
    tr->Commit();

}
catch (IBPP::Exception &e)
{
    tr->Rollback();
    cerr << e.ErrorMessage() << endl;
}

我无法理解此错误,因为此代码与参考相同! 我什么都找不到。

我的错。 IBPP API仅涵盖2.5.x Firebird版本。我在3.0.x上进行了测试

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)