int nRet = sqlite3_open(szFile, &mpDB);
if (nRet != SQLITE_OK)
{
}
setBusyTimeout(mnBusyTimeoutMs);
sqlite3_exec(mpDB, "Begin Transaction;", 0, 0, &szError);
sqlite3_exec(mpDB, "UPDATE query", 0, 0, &szError);//some update table query
sqlite3_exec(mpDB, "Commit Transaction;", 0, 0, &szError);///Here it gives error database is locked
Above code works fine for insert command instead of update command.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…