SQLite Forum

Unexepected commit result with two threads application
Login
Thanks, indeed according to lang_transaction.html
 <blockquote>
"SQLite attempts to undo just the one statement it was working on and leave changes from prior statements within the same transaction intact ... However, ... it might be necessary for SQLite to rollback.  An application can tell which course of action SQLite took by using the sqlite3_get_autocommit()... "
 </blockquote>

It's interesting that in my case the codes and states are strange or at least make no sense to me. 

COMMIT sqlite3_step in the main thread when supposedly another thread is still reading.

  *  SQLITE_BUSY, sqlite3_get_autocommit(): 0

  *  SQLITE_BUSY, sqlite3_get_autocommit(): 0

  *  SQLITE_DONE, sqlite3_get_autocommit(): 1  

I could stop trying if the step 2 gave me autocommit: 1, but there's no one, so the next step looked like success, but actually according to the data, led to a rollback

I still suspect that there might be something wrong with my code.