C++ sqlite3如何知道一条sql语句执行成功?
我正在尝试使用 sqlite3 插入记录
我想知道如何知道它是否成功
string sqlstatement = "INSERT INTO abe_account (name,department,password) VALUES ("
+quotesql(name) + ","
+quotesql(department) + ","
+quotesql(password) + ");";
if (sqlite3_open("abeserver.db", &db) == SQLITE_OK)
{
sqlite3_prepare( db, sqlstatement.c_str(), -1, &stmt, NULL );//preparing the statement
sqlite3_step( stmt );//executing the statement
}
else
{
cout << "Failed to open db\n";
}
sqlite3_finalize(stmt);
我们如何从 sqlite3 获取成功信号,例如成功添加行或成功删除行等,并将值分配给布尔值或字符串