File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -488,7 +488,6 @@ def test_autocommit_compat_ctx_mgr(self):
488488 self .assertTrue (cx .in_transaction )
489489 self .assertFalse (cx .in_transaction )
490490
491- @unittest .expectedFailure # TODO: RUSTPYTHON; autocommit behavior differs
492491 def test_autocommit_enabled_executescript (self ):
493492 expected = ["BEGIN" , "SELECT 1" ]
494493 with memory_database (autocommit = True ) as cx :
@@ -498,7 +497,6 @@ def test_autocommit_enabled_executescript(self):
498497 cx .executescript ("SELECT 1" )
499498 self .assertTrue (cx .in_transaction )
500499
501- @unittest .expectedFailure # TODO: RUSTPYTHON; autocommit behavior differs
502500 def test_autocommit_disabled_executescript (self ):
503501 expected = ["SELECT 1" ]
504502 with memory_database (autocommit = False ) as cx :
Original file line number Diff line number Diff line change @@ -1761,11 +1761,11 @@ mod _sqlite3 {
17611761
17621762 let db = zelf. connection . db_lock ( vm) ?;
17631763
1764- // Start implicit transaction for DML statements unless in autocommit mode
1764+ // Only legacy transaction control starts implicit DML transactions.
17651765 if stmt. is_dml
17661766 && db. is_autocommit ( )
17671767 && zelf. connection . isolation_level . deref ( ) . is_some ( )
1768- && * zelf. connection . autocommit . lock ( ) != AutocommitMode :: Enabled
1768+ && * zelf. connection . autocommit . lock ( ) == AutocommitMode :: Legacy
17691769 {
17701770 db. begin_transaction (
17711771 zelf. connection
@@ -1855,11 +1855,11 @@ mod _sqlite3 {
18551855
18561856 let db = zelf. connection . db_lock ( vm) ?;
18571857
1858- // Start implicit transaction for DML statements unless in autocommit mode
1858+ // Only legacy transaction control starts implicit DML transactions.
18591859 if stmt. is_dml
18601860 && db. is_autocommit ( )
18611861 && zelf. connection . isolation_level . deref ( ) . is_some ( )
1862- && * zelf. connection . autocommit . lock ( ) != AutocommitMode :: Enabled
1862+ && * zelf. connection . autocommit . lock ( ) == AutocommitMode :: Legacy
18631863 {
18641864 db. begin_transaction (
18651865 zelf. connection
@@ -1909,7 +1909,9 @@ mod _sqlite3 {
19091909
19101910 db. sql_limit ( script. byte_len ( ) , vm) ?;
19111911
1912- db. implicit_commit ( vm) ?;
1912+ if * zelf. connection . autocommit . lock ( ) == AutocommitMode :: Legacy {
1913+ db. implicit_commit ( vm) ?;
1914+ }
19131915
19141916 let script = script. to_cstring ( vm) ?;
19151917 let mut ptr = script. as_ptr ( ) ;
You can’t perform that action at this time.
0 commit comments