Skip to content

Conversation

@erlend-aasland
Copy link
Contributor

@erlend-aaslanderlend-aasland commented Apr 15, 2022

Unless sqlite3_blob_open() returns SQLITE_MISUSE, the error code and
message are available on the connection object. This means we have to
handle SQLITE_MISUSE error messages explicitly.

gh-69093

Unless sqlite3_blob_open() returns SQLITE_MISUSE, the error code and message are available on the connection object. This means we have to handle SQLITE_MISUSE error messages explicitly.
@erlend-aasland
Copy link
ContributorAuthor

I noticed this comment in the sqlite3_blob_open docs:

Unless it returns SQLITE_MISUSE, this function sets the database connection error code and message accessible via sqlite3_errcode() and sqlite3_errmsg() and related functions.

_pysqlite_seterror uses the error code/message that is set on the connection object, so we need to handle the SQLITE_MISUSE case explicitly. Unfortunately (or luckily), there is no way for us to force such an error, so we cannot add a unit test for this.

@erlend-aasland
Copy link
ContributorAuthor

erlend-aasland commented Apr 15, 2022

This reminds me that we need to map SQLITE_MISUSE to InterfaceError iso. ProgrammingError. But that belongs to issue #89022.

UPDATE, see gh-91572.

@JelleZijlstraJelleZijlstra merged commit c06a4ff into python:mainApr 15, 2022
@erlend-aaslanderlend-aasland deleted the sqlite-blob-misuse branch April 15, 2022 17:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@erlend-aasland@JelleZijlstra@bedevere-bot