On 2016-09-29 15:17, Otto Wallenius wrote:
[...]
To my understanding it follows that if you first call sqlite3_column_blob()
and then sqlite3_errcode(), the errcode might be SQLITE_NOMEM whether
memory allocation failed or not: either it failed and the error code was
set ot SQLITE_NOMEM, or it succeeded and the code happened to be
SQLITE_NOMEM because it is undefined.

Is this correct, and how can you check for errors in this case?

Actually, sqlite3_errcode() is unchanged in case of success (i.e. it returns the last failure's code). If you want to use the sole, pure ``sqlite3_*'' API, then try to reset sqlite3_errcode() to SQLITE_OK by using the following NOP:

sqlite3_exec(db, NULL, NULL, NULL, NULL);

just before sqlite3_column_blob() or family is called and check a value of sqlite3_errcode() just after the called function has returned --- if the value is still SQLITE_OK (regardless of what the called function returned: 0/0.0/NULL or not) then an error has not occurred.

-- best regards

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

Reply via email to