我有一个C ++程序,它具有此功能,在某些时候调用sqlite3_step()。事实证明,当达到sqlite3_step()函数时,程序会发出错误消息“程序已意外完成”。究竟我在这里做错了什么?
bool Database::removeRepository(string repoName)
{
string sql = "DELETE FROM ";
sql += tableName + " WHERE NAME='" + repoName + "'";
sqlite3_stmt* deleteStmt = nullptr;
int prep_results = sqlite3_prepare_v2(connection, sql.c_str(), sql.size(), &deleteStmt, NULL);
int results = sqlite3_step(deleteStmt);
sqlite3_finalize(deleteStmt);
if(results == SQLITE_DONE)
return true;
else
return false;
}