[New-bugs-announce] [issue24139] Use sqlite3 extended error codes

Dima Tisnek report at bugs.python.org
Thu May 7 11:19:35 CEST 2015


New submission from Dima Tisnek:

Let's fetch extended error codes from SQLite, information contained is not particularly interesting to the user, but may be invaluable in debugging!

http://www.sqlite.org/rescode.html
https://sqlite.org/c3ref/extended_result_codes.html
http://www.sqlite.org/c3ref/errcode.html

Current behaviour:

For example, consider that extended error was SQLITE_READONLY_DBMOVED, it would be set in https://github.com/mackyle/sqlite/blob/1caed0ecc62583c4f8a509ff66ae99b6939fe727/src/pager.c#L4836 without explicit detail string.

Python will call sqlite3_errcode() which will strip extended information via `& errMask` in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L2176

Python will then call sqlite3_errmsg(), and the error message will be according to truncated (simple) error per:
https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318

P.S. there are a few cases where sqlite3 internally sets both error code and message, in those cases, current Python module (presumably) reads out the error message correctly. For example https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1584

----------
components: Extension Modules
messages: 242710
nosy: Dima.Tisnek
priority: normal
severity: normal
status: open
title: Use sqlite3 extended error codes
type: enhancement
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24139>
_______________________________________


More information about the New-bugs-announce mailing list