David, On Wed, Jun 20, 2018 at 9:12 PM, David Empson <demp...@emptech.co.nz> wrote: > Apart from the SQLITE_OK vs SQLITE_ROW/DONE check on the sqlite3_step() call > mentioned already, you also have the third parameter to sqlite_prepare_v2() > wrong: nByte = NULL will translate to nByte = 0 which is documented as “no > prepared statement is generated”. Therefore stmt is not valid and > sqlite3_step() returns SQLITE_MISUSE.
That was it. I don't usually supply the hardcoded query to the sqlite3_prepare_v2() call, just a variable name. Thank you. > > Try -1 instead of NULL. > >> On 21/06/2018, at 12:44 PM, Igor Korot <ikoro...@gmail.com> wrote: >> >> Hi, guys, >> I put in this code: >> >> if( sqlite3_prepare_v2( m_db, "PRAGMA >> schema_version", NULL, &stmt, NULL ) == SQLITE_OK ) >> { >> if( ( res = sqlite3_step( stmt ) ) == SQLITE_OK ) >> { >> m_schema = sqlite3_column_int( stmt, 0 ); >> pimpl->m_dbName = sqlite_pimpl->m_catalog; >> } >> else >> { >> } >> } >> else >> { >> } >> >> The call to sqlite3_step() failed - it returned 21. >> >> Anyone sees any issues? >> >> Thank you. > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users