SQLITE错误:无法重置虚拟机

Sqlite error: Could not reset the virtual machine

本文关键字:虚拟机 错误 SQLITE      更新时间:2023-10-16

我正在尝试从CSV文件读取,并将每一行添加到C 中的数据库中。CSV文件以id,firstname,surname,job的形式我的代码是:

while (file.good())
        {
          getline (file, id, ',');
          getline (file, firstname, ',');
          getline (file, surname, ',');
          getline (file, job, ' ');
          cur->set_sql( "INSERT INTO staff VALUES (?, ?, ?, ?);" );
          cur->prepare();
          cur->bind(1, id);
          cur->bind(2, firstname);
          cur->bind(3, surname);
          cur->bind(4, job);
          cur->step();
          cur->reset();
        }

但是,当我运行代码时,它返回错误 Sqlite error: Could not reset the virtual machine.,我不明白这意味着什么或如何解决。我在Google上搜索了错误,但我找不到任何内容

错误来自 libsqlite.hpp(在github.com上检查搜索搜索(

void reset(){
        int rc = sqlite3_reset(this->_s);
        if (rc != SQLITE_OK) {
            exception e("Could not reset the virtual machine.");
            throw e;
        }
        this->_valid = true;
        this->_has_row = false;
        this->_prepared = false;
}

我还没有挖掘此操作,但看起来SQILTE查询包含错误或无法运行。

我发现了如何解决此错误。我意识到自己正在使用虚拟机上编程,我要做的就是重新启动它。我的代码没有错!