Small. Fast. Reliable.
Choose any three.
Error Code SQLITE_MISUSE (21) "Library routine called out of sequence"

The SQLITE_MISUSE error code is returned when you misuse the SQLite library in some way. SQLite does not guarantee that it will detect misuse, so you should not depend on this behavior in any way. The SQLITE_MISUSE error code is intended to help you find the bugs in your code.

Here are some possible causes of SQLITE_MISUSE:

  1. Calling any API routine with an sqlite3* pointer that was not obtained from sqlite3_open() or sqlite3_open16() or which has already been closed by sqlite3_close().

  2. Trying to use the same database connection at the same instant in time from two or more threads.

  3. Calling sqlite3_step() with a sqlite3_stmt* statement pointer that was not obtained from sqlite3_prepare() or sqlite3_prepare16() or that has already been destroyed by sqlite3_finalize().

  4. Trying to bind values to a statement (using sqlite3_bind_...()) while that statement is running.