mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour (#93823)
Introduce the autocommit attribute to Connection and the autocommit parameter to connect() for PEP 249-compliant transaction handling. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
This commit is contained in:
parent
99972dc745
commit
c95f554a40
14 changed files with 537 additions and 62 deletions
|
|
@ -39,6 +39,12 @@ typedef struct _callback_context
|
|||
pysqlite_state *state;
|
||||
} callback_context;
|
||||
|
||||
enum autocommit_mode {
|
||||
AUTOCOMMIT_LEGACY = LEGACY_TRANSACTION_CONTROL,
|
||||
AUTOCOMMIT_ENABLED = 1,
|
||||
AUTOCOMMIT_DISABLED = 0,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
|
|
@ -51,6 +57,7 @@ typedef struct
|
|||
|
||||
/* NULL for autocommit, otherwise a string with the isolation level */
|
||||
const char *isolation_level;
|
||||
enum autocommit_mode autocommit;
|
||||
|
||||
/* 1 if a check should be performed for each API call if the connection is
|
||||
* used from the same thread it was created in */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue