This change handles corruption of the database when it isn't discovered by keen_io_sqlite3_open due to contents of the db being read in on demand. In this case the most likely place corruption will be discovered is the first operation performed on the db which is the first create table command. So, we'll now check for corruption on that first command and replace the database if need be. I've added a unit test that covers this code path.
Coverage increased (+1.3%) to 60.845% when pulling d8f4a06c3d732963962a77c0fb29e71f15384c63 on fix_db_corruption into ccda25864122332d3845262ad211625a9ca74568 on master.
Coverage increased (+4.7%) to 64.267% when pulling 1cc287e334abb97b84530e469477c7e2474a4186 on fix_db_corruption into ccda25864122332d3845262ad211625a9ca74568 on master.
This change handles corruption of the database when it isn't discovered by keen_io_sqlite3_open due to contents of the db being read in on demand. In this case the most likely place corruption will be discovered is the first operation performed on the db which is the first create table command. So, we'll now check for corruption on that first command and replace the database if need be. I've added a unit test that covers this code path.