SQLite Forum

facing issue from sqlite3_step()
Hi Team,
I am facing an issue from sqlite3_step(). Issue is that there are 3 records are present in my database table 'A'. On thread is trying to read all the record from the table 'A' (I am using sqlite3_prepare_v2 and sqlite3_step function for this) and from second thread I am updating the fetched information by thread 1 (ie, One thread is reading the data another thread is writing the data which is read by thread 1. For writing I am using INSERT OR REPLACE INTO query). I am using sqlite3_step function inside a loop to read all the three records from table A. 
eg. while(SQLITE_ROW == sqlite3_step(*statement) {
      // reading the information using sqlite3_column_xx
If I repeatably do this read and update, For the first few loop everything is working fine I received all the records correctly. But at some point sqlite3_step is going for extra iteration. That means since there are 3 records present in DB sqlite3_step loop(above) should iterate only 3 times. But here it is going for 4th iteration and giving the same record which is already read. So I am expecting SQLITE_DONE but I am getting SQLITE_ROW after 3rd Iteration. My sqlite3 is in thread safe mode.

Thank you