SQLite Forum

Getting the error
Login
Hi, Gunter,

For a second lets forget about my last message.

This was my code:

```
if(  ( res = sqlite3_prepare_v2( m_db, "SELECT * FROM master.leagues", -1, &m_stmt, NULL ) ) != 0 )
{
    int code = sqlite_errcode( m_db );
}
```

This was my original code.

As you can see the _prepare call should fail and sqlite_errcode() line will be executed.

What I saw is the "code" variable will become 0 and therefore no error processing will occur.

When I changed that line to be:

```
char *message = sqlite_errmsg( m_db );
```

I did get an error message which said "No table master.leagues" and after I fixed the code everything started working correctly.

So, now the question is - are you able to get a 0 in my scenario #1?

I have MSVC 2017/Windows 8.1/SQLite 3.24.0 library embedded in the project.

Thank you.

P.S. Note - I hardcoded the query with the schema and table names to indicate a problem.