[sqlite] 回复: Why SQLITE_BUSY?

2015-12-15 Thread sanhua.zh
oh, sorry, I make this mistake. Another question is that if ?sqlite3_prepare? fail, do I need to ?sqlite3_finalize? the stmt. Here is the sample code, int ret = sqlite3_prepare(handle, ?some sql?, stmt, ?); if (ret==SQLITE_OK) { //step sqlite3_finalize(stmt); }else { //log error //should I

[sqlite] 回复: Why SQLITE_BUSY?

2015-12-15 Thread sanhua.zh
I?m very excited that I re-produce the SQLITE_BUSY code in a simple demo. Here is my test code, void showResultCode(int resultCode) { if (resultCode!=SQLITE_DONEresultCode!=SQLITE_OKresultCode!=SQLITE_ROW) { NSLog(@"unexperted result %d", resultCode); } } void SQLiteLog(void* userInfo,

[sqlite] 回复: Why SQLITE_BUSY?

2015-12-15 Thread Hick Gunter
It looks like you have unfinalized statements in your transaction. You are preparing statements inside the loop, but finalizing only 1 (the last) statement. And attempting to commit even before finalizing only the last statement. So sqlite3_close() is complaining about improper call sequence,