From 4a926caf8e5fd8af771b2c34bfb6e91c732331fe Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sun, 26 Feb 2017 18:22:38 +0300 Subject: bpo-28518: Start a transaction implicitly before a DML statement (#245) Patch by Aviv Palivoda. --- Lib/sqlite3/test/transactions.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Lib') diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py index 45f1b04c69..b8a13de55b 100644 --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -179,6 +179,15 @@ class TransactionalDDL(unittest.TestCase): result = self.con.execute("select * from test").fetchall() self.assertEqual(result, []) + def CheckImmediateTransactionalDDL(self): + # You can achieve transactional DDL by issuing a BEGIN + # statement manually. + self.con.execute("begin immediate") + self.con.execute("create table test(i)") + self.con.rollback() + with self.assertRaises(sqlite.OperationalError): + self.con.execute("select * from test") + def CheckTransactionalDDL(self): # You can achieve transactional DDL by issuing a BEGIN # statement manually. -- cgit v1.2.1