On 1 Oct 2017, at 6:56pm, Bart Smissaert <bart.smissa...@gmail.com> wrote:

> I can see that if there is no error then then return value of
> sqlite3_errcode() can be SQLITE_ROW (100) or SQLITE_DONE (101). So, to
> check if there is an error (other than looking at all the
> return values) do I need to check that sqlite3_errcode() returns something
> other than 0, 100 or 101 or are there other values that could be returned
> that don't indicate an error?

There’s no good way to do this.  You have to check the code returned by each 
function call as it is returned.

You could check sqlite3_errcode() and find it give you an error code.  But you 
don’t know if that error was caused by the most recent function call or one 
five calls ago.  And sqlite3_errcode() might theoretically return 100, but that 
doesn’t mean there wasn’t an error before the last successful call to 
sqlite3_step().

If you check the codes returned by each function call instead, then your list 
is correct: 0, 100 and 101 indicate success (of a kind).  Any other value means 
a failure.  However, in theory all values from 1 to 99 would be errors, and 
using this range might help to future-proof your code.

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

Reply via email to