SQLite Forum

sqlite3_errcode(db_instance) incorrectly returns SQLITE_OK(0) when last error code was SQLITE_READONLY(8)
Login

sqlite3_errcode(db_instance) incorrectly returns SQLITE_OK(0) when last error code was SQLITE_READONLY(8)

(1) By anonymous on 2021-07-30 07:17:31 [source]

In 3.35.5, sqlite3_extended_errcode/sqlite3_errcode(db_instance) does not return the correct errorcode when the last operation returned errorcode was SQLITE_READONLY(8). All other codes seems to be working fine.

When we try to do a write operation (e.g sqlite3_backup_step with query value:BEGIN EXCLUSIVE TRANSACTION) on a db opened with an existing readonly(lacking write permission) db file, the returned errorcode is SQLITE_READONLY(8) as expected but post this errorcode, if we do sqlite3_errcode(db_instance), the error code returned is 0(SQLITE_OK). In the previous version v3.32.1, the api sqlite3_errcode was returning the same error code as of the last operation.

This seems to be the case with only SQLITE_READONLY(8) error code only. other codes are still handled properly.

Please fix this.