bpo-24139: Add support for SQLite extended result codes (GH-28076)

This commit is contained in:
Erlend Egeberg Aasland 2021-11-03 00:49:38 +01:00 committed by GitHub
parent a459a81530
commit 456e27ac0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 263 additions and 7 deletions

View file

@ -72,6 +72,8 @@ get_exception_class(pysqlite_state *state, int errorcode)
return state->IntegrityError;
case SQLITE_MISUSE:
return state->ProgrammingError;
case SQLITE_RANGE:
return state->InterfaceError;
default:
return state->DatabaseError;
}
@ -139,9 +141,10 @@ _pysqlite_seterror(pysqlite_state *state, sqlite3 *db)
}
/* Create and set the exception. */
int extended_errcode = sqlite3_extended_errcode(db);
const char *errmsg = sqlite3_errmsg(db);
raise_exception(exc_class, errorcode, errmsg);
return errorcode;
raise_exception(exc_class, extended_errcode, errmsg);
return extended_errcode;
}
#ifdef WORDS_BIGENDIAN