Reputation: 18123
I have a C++ program which has this function that at some point calls sqlite3_step(). It turn out that when sqlite3_step() function is reached the program clashes with a message "The program has unexpectedly finished." What exactly Am I doing wrong here?
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;
}
Upvotes: 0
Views: 256
Reputation: 7823
Almost certainly your sqlite3_prepare_v2
call is failing. You should check the value of prep_results
and see what the value is (there is a list here)
Upvotes: 1