Code:
sqlite3_stmt *stmt = NULL;
int ret = Sqlite3_prepare ();
ret = Sqlite3_bind_int (stmt, 1, id);
ret = Sqlite3_step (stmt);
const char *MST = SQLITE3_ERRSTR (ret);
Analysis:
1)
Error message for MST: library routine called out of sequence
Online search is a problem caused by multi-threaded access to the database, the results read through the code, found that no multi-threaded access to the database, and the normal destruction of stmt objects
2)
Try to execute the command statement manually, the error prompt is as follows: no such column:admin
Note that there is a problem with the SQL statement, test the return value of the Sqlite3_prepare function, the error prompt is as follows: SQL logic error or missing database. By modifying the SQL statement, you can finally query normally.
Summary: The Sqlite3_prepare function parses whether the SQL statement is written correctly and returns an error if it is incorrect, causing the following query to fail
SQLite Sixth lesson Sqlite3_prepare function call Exception analysis