mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-28518: Start a transaction implicitly before a DML statement (#245)
Patch by Aviv Palivoda.
This commit is contained in:
parent
46ce7599af
commit
4a926caf8e
5 changed files with 24 additions and 11 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue