mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-24139: Add support for SQLite extended result codes (GH-28076)
This commit is contained in:
parent
a459a81530
commit
456e27ac0a
5 changed files with 263 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue