"Lukhnos D. Liu" <lukhnos...@lithoglyph.com>
wrote in message
news:24584eea-b339-408d-805b-9616cc7d9...@lithoglyph.com
> Here's the interesting part. When my app failed, the preparation
> always returned SQLITE_MISUSE. That was a very curious error. I
> searched the documents, and it wasn't entirely clear to me why one
> would get SQLITE_MISUSE when preparing a statement.
>
> The problem was solved by finalziing the prepared statement
> *immediately* after it was used.
>
> Still, the question is why?

All statements prepared with sqlite3_prepare[16] are invalidated 
whenever you change database schema in any way. Next time you use such a 
statement, you get SQLITE_MISUSE error and you have to finalize and 
re-prepare it.

Use the newer sqlite3_prepare[16]_v2 API: it stores the text of the 
statement internally, and automatically re-prepares it as necessary.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to