You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems reasonable to provide as much error information as is available, one way or another. Would you like to work on a patch?
palaviv commented on Aug 30, 2016
palavivmannequin
Mannequin
More actions
Attached is a patch to enable the extended error codes. This patch should be dependent on bpo-16379.
Without returning the sqlite error code in the exception the extended error code does not reveal any information not currently available. As you can see in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318 there are messages only for the non-extended error codes and that is what is exposed now.
dimaqq commented on Aug 31, 2016
dimaqqmannequin
MannequinAuthor
More actions
Aviv the patch makes in itself.
Are the changes in the other ticket needed to implement new tests?
Or is it possible to include tests here?
dimaqq commented on Aug 31, 2016
dimaqqmannequin
MannequinAuthor
More actions
I meant "the patch makes sense in itself".
palaviv commented on Aug 31, 2016
palavivmannequin
Mannequin
More actions
Are the changes in the other ticket needed to implement new tests?
Or is it possible to include tests here?
It is not possible to add any tests to this issue before exposing the error code. I will implement new tests when bpo-16379 will be resolved.
Aviv the patch makes in itself.
I think that this issue should be dependent on bpo-16379 as the behavior of the sqlite module will no be changed after this patch until bpo-16379 is resolved. In addition there will be some "rebase" issues that will need to be solved.
New changeset 0dfb8c4 by Erlend Egeberg Aasland in branch 'main': bpo-24139: Fix test_sqlite3 test_extended_error_code_on_exception() on s390x RHEL buildbots (GH-29382) 0dfb8c4
Activity
dimaqq commentedon May 7, 2015
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
& errMaskin https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L2176Python 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
bitdancer commentedon May 7, 2015
It seems reasonable to provide as much error information as is available, one way or another. Would you like to work on a patch?
palaviv commentedon Aug 30, 2016
Attached is a patch to enable the extended error codes. This patch should be dependent on bpo-16379.
Without returning the sqlite error code in the exception the extended error code does not reveal any information not currently available. As you can see in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318 there are messages only for the non-extended error codes and that is what is exposed now.
dimaqq commentedon Aug 31, 2016
Aviv the patch makes in itself.
Are the changes in the other ticket needed to implement new tests?
Or is it possible to include tests here?
dimaqq commentedon Aug 31, 2016
I meant "the patch makes sense in itself".
palaviv commentedon Aug 31, 2016
It is not possible to add any tests to this issue before exposing the error code. I will implement new tests when bpo-16379 will be resolved.
I think that this issue should be dependent on bpo-16379 as the behavior of the sqlite module will no be changed after this patch until bpo-16379 is resolved. In addition there will be some "rebase" issues that will need to be solved.
pablogsal commentedon Nov 2, 2021
New changeset 456e27a by Erlend Egeberg Aasland in branch 'main':
bpo-24139: Add support for SQLite extended result codes (GH-28076)
456e27a
Fidget-Spinner commentedon Nov 3, 2021
New changeset 0dfb8c4 by Erlend Egeberg Aasland in branch 'main':
bpo-24139: Fix test_sqlite3
test_extended_error_code_on_exception()on s390x RHEL buildbots (GH-29382)0dfb8c4