On Thu, Jun 6, 2013 at 4:12 PM, Jerry Krinock <je...@ieee.org> wrote:
> I just spent a couple hours on a really strange problem that went away. > > • Ann sqlite database had 13 rows in one of its tables. > • In App 1, which uses the "C" interface, add a new row. > • In App 2, which also uses the "C" interface, open that database with > sqlite3_open(), then run query "SELECT * from 'tableName'", using > sqlite3_prepare(), sqlite3_step() iteratively, and sqlite3_finalize(), then > sqlite3_wal_checkpoint_v2(passing SQLITE_CHECKPOINT_PASSIVE) and > sqlite3_close(). This is working code which I have not touched in five > years, except to update to the new checkpoint function. > > Expected Result: 14 rows > > Actual Result: 13 rows. The new row is absent. > My guess is that App1 never actually committed the transaction. Are you sure that you ran COMMIT? And are you sure that the COMMIT was successful? > > • Open the database using the sqlite3 command line tool built into Mac OS > X 10.8.4, and do the same query. Result: 14 rows. > • Repeat the open,query,checkpoint,close in App 2. Result: still 13 rows. > > • Peek inside the database main file, -shm file and -wal file with a text > editor. I see that the new row is not in the main file but is still in the > -wal file. I understand that -shm and -wal files are an implementation > detail of sqlite3, and that I should not worry about where the records are. > > • Quit and relaunch App 2. > > • Repeat the open,query,checkpoint,close in App 2. Result: now it gets > all 14 rows! > > I've since been retesting these apps for the last couple hours and all has > been fine since. > > App 1 is built with sqlite 3.7.15. > App 2 is built with sqlite 3.7.14. > The Mac's command line tool is sqlite 3.7.12. > > So, there's no explanation in the version numbers. > > This is very strange, but I did get down to the query level with the > debugger. > > Just prior to this sequence of events, I had deleted a half dozen records > in App 1, which kept showing up in queries in App 2. > > Any possible explanations would be appreciated. > > Jerry Krinock > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users