3

I recieve SQLITE_CORRUPT error for the database being corrupt.

wrong # of entries in index sqlite_autoindex_Settings_1

In my code I have a try/finally clause in which I always try to always sqlite3_finalize my statements.

Apparently on a corrupted database trying to finalize the statement raises again SQLITE_CORRUPT.

Question: Should I finalize my statements if the database is reported to be corrupted?

Gad D Lord
  • 6,620
  • 12
  • 60
  • 106
  • 4
    if you have a corrupt db, whether or not you finalize a particular statement is the least of your worries. something has gone very, very wrong and you need to find out what. – andrew cooke Feb 28 '12 at 14:21

2 Answers2

1

before sqlite3_finalize or after every sqlite3_step use sqlite3_reset.

The sqlite3_reset(S) interface resets the prepared statement S back to the beginning of its program.

0

check whether you have sqlite3_reset after every sqlite3_step because this is one case that causes database to be corrupt. after preparing a statement with sqlite3_prepare and executing it with sqlite3_step,you need to always reset it with sqlite3_reset.

The sqlite3_reset(S) interface resets the prepared statement S back to the beginning of its program.

before sqlite3_finalize or after every sqlite3_step use sqlite3_reset.

hope this solves your problem...!!!

vinayak jadi
  • 859
  • 8
  • 16