On Mar 2, 2009, at 9:52 PM, Lukhnos D. Liu wrote: > Hi, > > I posted a question a few days ago on the cause of getting > SQLITE_MISUSE when I called sqlite3_prepare_v2. I thought I both ruled > out the possibilites advised by the replies and solved the probelm by > finalizing statements on the sqlite_master table earlier. > > Well the problem didn't get solved this way (as my hunch told me). > What really happened surprised me. Again I was wondering the root > cause of it. > > It turned out that I have the following execution history: > > Time Thread A Thread B > 0 prepare foo > 1 prepare bar > 2 finalize foo > 3 step bar > 4 finalize bar > 5 prepare baz (*) > > (*) indicates that I started getting SQLITE_MISUSE from this point on. > > I'm still wondering why it is impossible to call sqlite3_finalize in a > situation like this. The document doesn't seem to warn against it > (although the doc warns the evilness of threading in general). Or is > the root cause deeper? >
The above is suppose to work: Please do this for me. Run your program in a debugger. And every time you enter the sqlite3_prepare function, print the value of db- >magic in hex. Send me the results, especially for the case when you invoke "prepare baz." D. Richard Hipp d...@hwaci.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users